Command Usage

- Enhanced CmdHelp by adding aliases.
- Corrected usage for CmdModify.
- Renamed CmdQuery --> CmdExport.
- Added an alias _query --> export.
This commit is contained in:
Paul Beckingham 2011-07-12 00:51:05 -04:00
parent 3ef8f3f31a
commit 4d410972d4
8 changed files with 31 additions and 17 deletions

View file

@ -308,7 +308,7 @@ std::string Config::defaults =
"alias.rm=delete # Alias for the delete command\n"
"alias.history=history.monthly # Prefer monthly over annual history reports\n"
"alias.ghistory=ghistory.monthly # Prefer monthly graphical over annual history reports\n"
"alias.export=_query # Prefer JSON as the prime format\n"
"alias._query=export # _query is now export\n"
"alias.export.vcalendar=export.ical # They are the same\n"
"alias.export.json=_query # The _query command will be used for all export\n"
"alias.burndown=burndown.weekly # Prefer the weekly burndown chart\n"

View file

@ -23,6 +23,7 @@ set (commands_SRCS Command.cpp Command.h
CmdDuplicate.cpp CmdDuplicate.h
CmdEdit.cpp CmdEdit.h
CmdExec.cpp CmdExec.h
CmdExport.cpp CmdExport.h
CmdHelp.cpp CmdHelp.h
CmdHistory.cpp CmdHistory.h
CmdIDs.cpp CmdIDs.h
@ -37,7 +38,6 @@ set (commands_SRCS Command.cpp Command.h
CmdProjects.cpp CmdProjects.h
CmdPull.cpp CmdPull.h
CmdPush.cpp CmdPush.h
CmdQuery.cpp CmdQuery.h
CmdReports.cpp CmdReports.h
CmdShell.cpp CmdShell.h
CmdShow.cpp CmdShow.h

View file

@ -30,22 +30,22 @@
#include <Context.h>
#include <main.h>
#include <i18n.h>
#include <CmdQuery.h>
#include <CmdExport.h>
extern Context context;
////////////////////////////////////////////////////////////////////////////////
CmdQuery::CmdQuery ()
CmdExport::CmdExport ()
{
_keyword = "_query";
_usage = "task _query [<filter>]";
_description = STRING_CMD_QUERY_USAGE;
_keyword = "export";
_usage = "task export [<filter>]";
_description = STRING_CMD_EXPORT_USAGE;
_read_only = true;
_displays_id = true;
}
////////////////////////////////////////////////////////////////////////////////
int CmdQuery::execute (std::string& output)
int CmdExport::execute (std::string& output)
{
int rc = 0;

View file

@ -24,17 +24,17 @@
// USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_CMDQUERY
#define INCLUDED_CMDQUERY
#ifndef INCLUDED_CMDEXPORT
#define INCLUDED_CMDEXPORT
#define L10N // Localization complete.
#include <string>
#include <Command.h>
class CmdQuery : public Command
class CmdExport : public Command
{
public:
CmdQuery ();
CmdExport ();
int execute (std::string&);
};

View file

@ -90,6 +90,20 @@ int CmdHelp::execute (std::string& output)
}
}
// Add the aliases commands.
row = view.addRow ();
view.set (row, 1, " ");
std::map <std::string, std::string>::iterator alias;
for (alias = context.aliases.begin ();
alias != context.aliases.end ();
++alias)
{
row = view.addRow ();
view.set (row, 1, alias->first);
view.set (row, 2, "Aliased to '" + alias->second + "'");
}
/*
row = view.addRow ();
view.set (row, 1, "task ID /from/to/g");

View file

@ -54,6 +54,7 @@
#include <CmdDuplicate.h>
#include <CmdEdit.h>
#include <CmdExec.h>
#include <CmdExport.h>
#include <CmdHelp.h>
#include <CmdHistory.h>
#include <CmdIDs.h>
@ -68,7 +69,6 @@
#include <CmdProjects.h>
#include <CmdPull.h>
#include <CmdPush.h>
#include <CmdQuery.h>
#include <CmdReports.h>
#include <CmdShell.h>
#include <CmdShow.h>
@ -117,6 +117,7 @@ void Command::factory (std::map <std::string, Command*>& all)
c = new CmdDuplicate (); all[c->keyword ()] = c;
c = new CmdEdit (); all[c->keyword ()] = c;
c = new CmdExec (); all[c->keyword ()] = c;
c = new CmdExport (); all[c->keyword ()] = c;
c = new CmdGHistoryMonthly (); all[c->keyword ()] = c;
c = new CmdGHistoryAnnual (); all[c->keyword ()] = c;
c = new CmdHelp (); all[c->keyword ()] = c;
@ -134,7 +135,6 @@ void Command::factory (std::map <std::string, Command*>& all)
c = new CmdProjects (); all[c->keyword ()] = c;
c = new CmdPull (); all[c->keyword ()] = c;
c = new CmdPush (); all[c->keyword ()] = c;
c = new CmdQuery (); all[c->keyword ()] = c;
c = new CmdReports (); all[c->keyword ()] = c;
c = new CmdShell (); all[c->keyword ()] = c;
c = new CmdShow (); all[c->keyword ()] = c;

View file

@ -182,7 +182,7 @@
#define STRING_CMD_IDS_USAGE_RANGE "Shows only the IDs of matching tasks, in the form of a range."
#define STRING_CMD_IDS_USAGE_LIST "Shows only the IDs of matching tasks, in the form of a list."
#define STRING_CMD_IDS_USAGE_ZSH "Shows the IDs and descriptions of matching tasks."
#define STRING_CMD_QUERY_USAGE "Executes external commands and scripts"
#define STRING_CMD_EXPORT_USAGE "Executes external commands and scripts"
#define STRING_CMD_INFO_USAGE "Shows all data and metadata for specified tasks."
#define STRING_CMD_INFO_BLOCKED "This task blocked by"
#define STRING_CMD_INFO_BLOCKING "This task is blocking"