Calc command
- Added framework for new 'calc' command.
This commit is contained in:
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user