mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +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
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue