mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Commands
- Implemented stubbed Context::initialize2. - Implemented combined command line. - Migrated some code from Context::initialize to ::initialize2. - Integrated ::initialize2 into the startup sequence. - Implemented Context::dispatch2. - Integrated ::dispatch2 into the run sequence. - Implemented Context::updateXtermTitle. - Added debug messages to new Command objects. - Implemented CmdLogo, which implements the _logo command, for fun. - Removed unnecessary base class overrides from Cmd* objects.
This commit is contained in:
parent
02c2023dc4
commit
557440db0c
13 changed files with 215 additions and 141 deletions
|
@ -28,52 +28,15 @@
|
|||
#include <iostream>
|
||||
#include <CmdLogo.h>
|
||||
#include <Context.h>
|
||||
#include <text.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdLogo::CmdLogo ()
|
||||
/*
|
||||
: _name ("")
|
||||
*/
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdLogo::CmdLogo (const CmdLogo& other)
|
||||
{
|
||||
/*
|
||||
_minimum = other._minimum;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdLogo& CmdLogo::operator= (const CmdLogo& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
/*
|
||||
_name = other._name;
|
||||
*/
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CmdLogo::operator== (const CmdLogo& other) const
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
return _name == other._name &&
|
||||
_minimum == other._minimum &&
|
||||
_maximum == other._maximum &&
|
||||
_wrap == other._wrap &&
|
||||
_just == other._just &&
|
||||
_sizing == other._sizing;
|
||||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdLogo::~CmdLogo ()
|
||||
{
|
||||
|
@ -82,12 +45,16 @@ CmdLogo::~CmdLogo ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CmdLogo::read_only () const
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CmdLogo::implements (const std::string& command_line) const
|
||||
{
|
||||
// TODO Upgrade to a parsed value.
|
||||
if (command_line.find ("_logo") != std::string::npos)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -97,7 +64,7 @@ bool CmdLogo::implements (const std::string& command_line) const
|
|||
// Generate UUID
|
||||
// Call the "install" function once, store results in rc:
|
||||
// extension.<uuid>=<JSON>
|
||||
std::string CmdLogo::execute (const std::string&)
|
||||
int CmdLogo::execute (const std::string& commandLine, std::string& output)
|
||||
{
|
||||
static const char* data[] =
|
||||
{
|
||||
|
@ -132,10 +99,10 @@ std::string CmdLogo::execute (const std::string&)
|
|||
""
|
||||
};
|
||||
|
||||
std::string output;
|
||||
output += optionalBlankLine ();
|
||||
|
||||
for (int line = 0; data[line][0]; ++line)
|
||||
{
|
||||
|
||||
for (int c = 0; c < 14; ++c)
|
||||
{
|
||||
int value = (int) data[line][c];
|
||||
|
@ -163,9 +130,13 @@ std::string CmdLogo::execute (const std::string&)
|
|||
output += block;
|
||||
}
|
||||
}
|
||||
|
||||
output += "\n";
|
||||
}
|
||||
|
||||
return output;
|
||||
output += optionalBlankLine ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue