mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Calc command
- Added framework for new 'calc' command.
This commit is contained in:
parent
26267a7473
commit
561e3b5a9b
9 changed files with 103 additions and 185 deletions
1
doc/man/.gitignore
vendored
1
doc/man/.gitignore
vendored
|
@ -4,3 +4,4 @@ task-sync.5
|
|||
task-tutorial.5
|
||||
task.1
|
||||
taskrc.5
|
||||
tasksh.1
|
||||
|
|
185
doc/man/tasksh.1
185
doc/man/tasksh.1
|
@ -1,185 +0,0 @@
|
|||
.TH tasksh 1 2013-03-09 "task 2.3.0" "User Manuals"
|
||||
|
||||
.SH NAME
|
||||
tasksh \- Interactive taskwarrior shell
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B tasksh [<commands-file>]
|
||||
.br
|
||||
.B tasksh --version
|
||||
.br
|
||||
.B tasksh --help
|
||||
|
||||
.SH DESCRIPTION
|
||||
The tasksh program can be used to create a more immersive task environment.
|
||||
Any task command you run outside the shell can also be run inside the shell,
|
||||
without the need to prefix every command with "task".
|
||||
|
||||
.br
|
||||
Moreover, task commands can be written in a file which can be passed or
|
||||
redirected to tasksh for batch execution.
|
||||
|
||||
.RS
|
||||
$ tasksh
|
||||
.br
|
||||
.B task 2.3.0
|
||||
shell
|
||||
.br
|
||||
|
||||
.br
|
||||
Enter any task command (such as 'list'), or hit 'Enter'.
|
||||
.br
|
||||
There is no need to include the 'task' command itself.
|
||||
.br
|
||||
Enter 'quit' to end the session.
|
||||
.br
|
||||
|
||||
.br
|
||||
task> projects
|
||||
.br
|
||||
|
||||
.br
|
||||
Project Tasks Pri:None Pri:L Pri:M Pri:H
|
||||
.br
|
||||
------- ----- -------- ----- ----- -----
|
||||
.br
|
||||
7 7 0 0 0
|
||||
.br
|
||||
home 2 2 0 0 0
|
||||
.br
|
||||
party 6 3 0 0 3
|
||||
.br
|
||||
|
||||
.br
|
||||
3 projects (15 tasks)
|
||||
.br
|
||||
task> tags
|
||||
.br
|
||||
|
||||
.br
|
||||
Tag Count
|
||||
.br
|
||||
mall 2
|
||||
.br
|
||||
|
||||
.br
|
||||
1 tag (15 tasks)
|
||||
.br
|
||||
task> list
|
||||
.br
|
||||
|
||||
.br
|
||||
ID Project Pri Due Active Age Description
|
||||
.br
|
||||
---------------------------------------------------------------------
|
||||
.br
|
||||
2 party H 10/17/2010 2 hrs Select and book a venue
|
||||
.br
|
||||
5 party H 10/22/2010 2 hrs Design invitations
|
||||
.br
|
||||
9 home 10/31/2010 1 hr Pay rent
|
||||
.br
|
||||
3 party 2 hrs Mail invitations
|
||||
.br
|
||||
4 party 2 hrs Select a caterer
|
||||
.br
|
||||
6 party 2 hrs Print invitations
|
||||
.br
|
||||
|
||||
.br
|
||||
8 tasks
|
||||
.br
|
||||
task> quit
|
||||
.br
|
||||
$
|
||||
.br
|
||||
$ cat task.commands
|
||||
.br
|
||||
add foo
|
||||
.br
|
||||
add bar
|
||||
.br
|
||||
$ tasksh task.commands
|
||||
.br
|
||||
task 2.3.0 shell
|
||||
.br
|
||||
|
||||
.br
|
||||
Enter any task command (such as 'list'), or hit 'Enter'.
|
||||
.br
|
||||
There is no need to include the 'task' command itself.
|
||||
.br
|
||||
Enter 'quit' to end the session.
|
||||
.br
|
||||
|
||||
.br
|
||||
task> add foo
|
||||
.br
|
||||
Created task 8.
|
||||
.br
|
||||
task> add bar
|
||||
.br
|
||||
Created task 9.
|
||||
.br
|
||||
$
|
||||
.br
|
||||
$ cat task.commands | tasksh
|
||||
.br
|
||||
task 2.3.0 shell
|
||||
.br
|
||||
|
||||
.br
|
||||
Enter any task command (such as 'list'), or hit 'Enter'.
|
||||
.br
|
||||
There is no need to include the 'task' command itself.
|
||||
.br
|
||||
Enter 'quit' to end the session.
|
||||
.br
|
||||
|
||||
.br
|
||||
task> add foo
|
||||
.br
|
||||
Created task 8.
|
||||
.br
|
||||
task> add bar
|
||||
.br
|
||||
Created task 9.
|
||||
.br
|
||||
|
||||
.RE
|
||||
|
||||
.SH "CREDITS & COPYRIGHTS"
|
||||
Copyright (C) 2006 \- 2013 P. Beckingham, F. Hernandez.
|
||||
|
||||
This man page was originally written by Federico Hernandez.
|
||||
|
||||
Taskwarrior is distributed under the MIT license. See
|
||||
http://www.opensource.org/licenses/mit-license.php for more information.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR task(1),
|
||||
.BR task-tutorial(5),
|
||||
.BR taskrc(5),
|
||||
.BR task-faq(5),
|
||||
.BR task-color(5),
|
||||
.BR task-sync(5)
|
||||
|
||||
For more information regarding taskwarrior, see the following:
|
||||
|
||||
.TP
|
||||
The official site at
|
||||
<http://taskwarrior.org>
|
||||
|
||||
.TP
|
||||
The official code repository at
|
||||
<git://tasktools.org/task.git/>
|
||||
|
||||
.TP
|
||||
You can contact the project by emailing
|
||||
<support@taskwarrior.org>
|
||||
|
||||
.SH REPORTING BUGS
|
||||
.TP
|
||||
Bugs in taskwarrior may be reported to the issue-tracker at
|
||||
<http://taskwarrior.org>
|
||||
|
|
@ -11,6 +11,7 @@ set (commands_SRCS Command.cpp Command.h
|
|||
CmdAnnotate.cpp CmdAnnotate.h
|
||||
CmdAppend.cpp CmdAppend.h
|
||||
CmdBurndown.cpp CmdBurndown.h
|
||||
CmdCalc.cpp CmdCalc.h
|
||||
CmdCalendar.cpp CmdCalendar.h
|
||||
CmdCommands.cpp CmdCommands.h
|
||||
CmdColor.cpp CmdColor.h
|
||||
|
|
54
src/commands/CmdCalc.cpp
Normal file
54
src/commands/CmdCalc.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <Context.h>
|
||||
#include <main.h>
|
||||
#include <i18n.h>
|
||||
#include <CmdCalc.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdCalc::CmdCalc ()
|
||||
{
|
||||
_keyword = "calc";
|
||||
_usage = "task calc <expression>";
|
||||
_description = STRING_CMD_CALC_USAGE;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdCalc::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
42
src/commands/CmdCalc.h
Normal file
42
src/commands/CmdCalc.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDED_CMDCALC
|
||||
#define INCLUDED_CMDCALC
|
||||
|
||||
#include <string>
|
||||
#include <Command.h>
|
||||
|
||||
class CmdCalc : public Command
|
||||
{
|
||||
public:
|
||||
CmdCalc ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -43,6 +43,7 @@
|
|||
#include <CmdAnnotate.h>
|
||||
#include <CmdAppend.h>
|
||||
#include <CmdBurndown.h>
|
||||
#include <CmdCalc.h>
|
||||
#include <CmdCalendar.h>
|
||||
#include <CmdColor.h>
|
||||
#include <CmdColumns.h>
|
||||
|
@ -106,6 +107,7 @@ void Command::factory (std::map <std::string, Command*>& all)
|
|||
c = new CmdBurndownDaily (); all[c->keyword ()] = c;
|
||||
c = new CmdBurndownMonthly (); all[c->keyword ()] = c;
|
||||
c = new CmdBurndownWeekly (); all[c->keyword ()] = c;
|
||||
c = new CmdCalc (); all[c->keyword ()] = c;
|
||||
c = new CmdCalendar (); all[c->keyword ()] = c;
|
||||
c = new CmdColor (); all[c->keyword ()] = c;
|
||||
c = new CmdColumns (); all[c->keyword ()] = c;
|
||||
|
|
|
@ -526,6 +526,7 @@
|
|||
#define STRING_CMD_CAL_LABEL_HOL "Holiday"
|
||||
#define STRING_CMD_CAL_SUN_MON "The 'weekstart' configuration variable may only contain 'Sunday' or 'Monday'."
|
||||
#define STRING_CMD_EDIT_USAGE "Launches an editor to modify a task directly"
|
||||
#define STRING_CMD_CALC_USAGE "Calculator"
|
||||
|
||||
// Config
|
||||
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."
|
||||
|
|
|
@ -526,6 +526,7 @@
|
|||
#define STRING_CMD_CAL_LABEL_HOL "Festivo"
|
||||
#define STRING_CMD_CAL_SUN_MON "La variable de configuración 'weekstart' solamente puede contener 'domingo' o 'lunes'."
|
||||
#define STRING_CMD_EDIT_USAGE "Lanza un editor para modificar una tarea directamente"
|
||||
#define STRING_CMD_CALC_USAGE "Calculator"
|
||||
|
||||
// Config
|
||||
#define STRING_CONFIG_OVERNEST "Archivo de configuración anidado hasta más de 10 niveles de profundidad - esto tiene que ser un error."
|
||||
|
|
|
@ -526,6 +526,7 @@
|
|||
#define STRING_CMD_CAL_LABEL_HOL "Holiday"
|
||||
#define STRING_CMD_CAL_SUN_MON "The 'weekstart' configuration variable may only contain 'Sunday' or 'Monday'."
|
||||
#define STRING_CMD_EDIT_USAGE "Launches an editor to modify a task directly"
|
||||
#define STRING_CMD_CALC_USAGE "Calculator"
|
||||
|
||||
// Config
|
||||
#define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue