mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-31 05:47:18 +02:00
Alias
- Removed last traces of Alias object.
This commit is contained in:
parent
bc24d107d5
commit
a91d6227f8
4 changed files with 12 additions and 28 deletions
|
@ -48,6 +48,7 @@ public:
|
||||||
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
||||||
|
|
||||||
void findBinary ();
|
void findBinary ();
|
||||||
|
void resolveAliases ();
|
||||||
void findOverrides ();
|
void findOverrides ();
|
||||||
void findCommand ();
|
void findCommand ();
|
||||||
void findIdSequence ();
|
void findIdSequence ();
|
||||||
|
@ -68,7 +69,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void findTerminator ();
|
void findTerminator ();
|
||||||
void resolveAliases ();
|
|
||||||
void findPattern ();
|
void findPattern ();
|
||||||
void findSubstitution ();
|
void findSubstitution ();
|
||||||
void findTag ();
|
void findTag ();
|
||||||
|
|
|
@ -40,9 +40,6 @@ int main (int argc, const char** argv)
|
||||||
parser.appendStdin ();
|
parser.appendStdin ();
|
||||||
parser.findOverrides ();
|
parser.findOverrides ();
|
||||||
|
|
||||||
Alias alias;
|
|
||||||
alias.resolve (parser.tree ());
|
|
||||||
|
|
||||||
// Read-only commands.
|
// Read-only commands.
|
||||||
parser.entity ("cmd", "active"); parser.entity ("readcmd", "active");
|
parser.entity ("cmd", "active"); parser.entity ("readcmd", "active");
|
||||||
parser.entity ("cmd", "all"); parser.entity ("readcmd", "all");
|
parser.entity ("cmd", "all"); parser.entity ("readcmd", "all");
|
||||||
|
|
|
@ -25,9 +25,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <sstream>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <Command.h>
|
#include <Command.h>
|
||||||
#include <CmdAliases.h>
|
#include <CmdAliases.h>
|
||||||
|
@ -48,22 +45,11 @@ CmdCompletionAliases::CmdCompletionAliases ()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CmdCompletionAliases::execute (std::string& output)
|
int CmdCompletionAliases::execute (std::string& output)
|
||||||
{
|
{
|
||||||
// Get a list of all aliases.
|
std::map <std::string, std::string>::iterator alias;
|
||||||
std::vector <std::string> aliases;
|
for (alias = context.config.begin (); alias != context.config.end (); ++alias)
|
||||||
|
if (alias->first.substr (0, 6) == "alias.")
|
||||||
|
output += alias->first.substr (6) + "\n";
|
||||||
|
|
||||||
std::map <std::string, std::string>::iterator it;
|
|
||||||
for (it = context.alias._aliases.begin (); it != context.alias._aliases.end (); ++it)
|
|
||||||
aliases.push_back (it->first);
|
|
||||||
|
|
||||||
// Sort alphabetically.
|
|
||||||
std::sort (aliases.begin (), aliases.end ());
|
|
||||||
|
|
||||||
std::stringstream out;
|
|
||||||
std::vector <std::string>::iterator a;
|
|
||||||
for (a = aliases.begin (); a != aliases.end (); ++a)
|
|
||||||
out << *a << "\n";
|
|
||||||
|
|
||||||
output = out.str ();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,13 +97,14 @@ int CmdHelp::execute (std::string& output)
|
||||||
view.set (row, 1, " ");
|
view.set (row, 1, " ");
|
||||||
|
|
||||||
std::map <std::string, std::string>::iterator alias;
|
std::map <std::string, std::string>::iterator alias;
|
||||||
for (alias = context.alias._aliases.begin ();
|
for (alias = context.config.begin (); alias != context.config.end (); ++alias)
|
||||||
alias != context.alias._aliases.end ();
|
|
||||||
++alias)
|
|
||||||
{
|
{
|
||||||
row = view.addRow ();
|
if (alias->first.substr (0, 6) == "alias.")
|
||||||
view.set (row, 1, alias->first);
|
{
|
||||||
view.set (row, 2, format (STRING_CMD_HELP_ALIASED, alias->second));
|
row = view.addRow ();
|
||||||
|
view.set (row, 1, alias->first.substr (6));
|
||||||
|
view.set (row, 2, format (STRING_CMD_HELP_ALIASED, alias->second));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output = "\n"
|
output = "\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue