mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-30 02:17:21 +02:00
CLI/Context
- Removed repeated header calls that display a reconstructed command line in the event that default.command is used.
This commit is contained in:
parent
65ca1ab84d
commit
97428397a5
2 changed files with 18 additions and 19 deletions
19
src/CLI.cpp
19
src/CLI.cpp
|
@ -1799,9 +1799,6 @@ void CLI::injectDefaults ()
|
||||||
std::string defaultCommand = context.config.get ("default.command");
|
std::string defaultCommand = context.config.get ("default.command");
|
||||||
if (defaultCommand != "")
|
if (defaultCommand != "")
|
||||||
{
|
{
|
||||||
if (context.config.getBoolean ("debug"))
|
|
||||||
context.debug (std::string ("No command or sequence found - assuming default.command '") + defaultCommand + "'.");
|
|
||||||
|
|
||||||
// Split the defaultCommand into separate args.
|
// Split the defaultCommand into separate args.
|
||||||
std::vector <std::string> tokens;
|
std::vector <std::string> tokens;
|
||||||
Lexer::token_split (tokens, defaultCommand);
|
Lexer::token_split (tokens, defaultCommand);
|
||||||
|
@ -1825,18 +1822,6 @@ void CLI::injectDefaults ()
|
||||||
}
|
}
|
||||||
|
|
||||||
_args = reconstructed;
|
_args = reconstructed;
|
||||||
|
|
||||||
// Extract a recomposed command line.
|
|
||||||
std::string combined;
|
|
||||||
for (a = _args.begin (); a != _args.end (); ++a)
|
|
||||||
{
|
|
||||||
if (combined.length ())
|
|
||||||
combined += ' ';
|
|
||||||
|
|
||||||
combined += a->attribute ("raw");
|
|
||||||
}
|
|
||||||
|
|
||||||
context.header ("[" + combined + "]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only an error in strict mode.
|
// Only an error in strict mode.
|
||||||
|
@ -1847,10 +1832,6 @@ void CLI::injectDefaults ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (context.config.getBoolean ("debug"))
|
|
||||||
context.debug ("Sequence but no command found - assuming 'information' command.");
|
|
||||||
context.header (STRING_ASSUME_INFO);
|
|
||||||
|
|
||||||
A info ("argDefault", "information");
|
A info ("argDefault", "information");
|
||||||
info.tag ("ASSUMED");
|
info.tag ("ASSUMED");
|
||||||
_args.push_back (info);
|
_args.push_back (info);
|
||||||
|
|
|
@ -245,6 +245,24 @@ int Context::initialize (int argc, const char** argv)
|
||||||
cli.initialize (argc, argv);
|
cli.initialize (argc, argv);
|
||||||
cli.analyze (true, true);
|
cli.analyze (true, true);
|
||||||
|
|
||||||
|
// Extract a recomposed command line.
|
||||||
|
bool foundDefault = false;
|
||||||
|
std::string combined;
|
||||||
|
std::vector <A>::const_iterator a;
|
||||||
|
for (a = cli._args.begin (); a != cli._args.end (); ++a)
|
||||||
|
{
|
||||||
|
if (combined.length ())
|
||||||
|
combined += ' ';
|
||||||
|
|
||||||
|
combined += a->attribute ("raw");
|
||||||
|
|
||||||
|
if (a->hasTag ("DEFAULT"))
|
||||||
|
foundDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundDefault)
|
||||||
|
header ("[" + combined + "]");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// [8] Run on.launch hooks.
|
// [8] Run on.launch hooks.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue