mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Feature #934
- Feature #934, supports 'reserved.lines' to indicate a multi-line prompt for use in conjunction with 'limit:page' (thanks to Robert Gill). - Removed 'locale' from the taskrc.5 man page. - Added verbosity token 'sync'. - Fixed bug in size calculation for 'limit:page', but there is still one more. - Corrected unit test limit.t given the above fix.
This commit is contained in:
parent
9cbd729553
commit
c5ff24358c
11 changed files with 62 additions and 12 deletions
|
@ -76,13 +76,14 @@ std::string Config::_defaults =
|
|||
"avoidlastcolumn=no # Fixes Cygwin width problem\n"
|
||||
"hyphenate=on # Hyphenates lines wrapped on non-word-breaks\n"
|
||||
"#editor=vi # Preferred text editor\n"
|
||||
"reserved.lines=1 # Assume a 1-line prompt\n"
|
||||
"\n"
|
||||
"# Miscellaneous\n"
|
||||
"verbose=yes # Provide maximal feedback\n"
|
||||
"#verbose=no # Provide regular feedback\n"
|
||||
"#verbose=nothing # Provide no feedback\n"
|
||||
"# # Comma-separated list. May contain any subset of:\n"
|
||||
"#verbose=blank,header,footnote,label,new-id,affected,edit,special,project\n"
|
||||
"#verbose=blank,header,footnote,label,new-id,affected,edit,special,project,sync\n"
|
||||
"confirmation=yes # Confirmation on delete, big changes\n"
|
||||
"indent.annotation=2 # Indent spaces for annotations\n"
|
||||
"indent.report=0 # Indent spaces for whole report\n"
|
||||
|
|
|
@ -451,6 +451,9 @@ bool Context::color ()
|
|||
// rc.verbose=nothing Show the absolute minimum.
|
||||
// rc.verbose=one,two Show verbosity for 'one' and 'two' only.
|
||||
//
|
||||
// TODO This mechanism is clunky, and should slowly evolve into something more
|
||||
// logical and consistent. This should probably mean that 'nothing' should
|
||||
// take the place of '0'.
|
||||
bool Context::verbose (const std::string& token)
|
||||
{
|
||||
if (! verbosity.size ())
|
||||
|
@ -470,7 +473,8 @@ bool Context::verbose (const std::string& token)
|
|||
verbosity[0] != "affected" && //
|
||||
verbosity[0] != "edit" && //
|
||||
verbosity[0] != "special" && //
|
||||
verbosity[0] != "project") //
|
||||
verbosity[0] != "project" && //
|
||||
verbosity[0] != "sync") //
|
||||
{
|
||||
verbosity.clear ();
|
||||
|
||||
|
|
|
@ -145,9 +145,11 @@ int CmdCustom::execute (std::string& output)
|
|||
|
||||
// Adjust for fluff in the output.
|
||||
if (maxlines)
|
||||
maxlines -= (context.verbose ("blank") ? 1 : 0)
|
||||
+ table_header
|
||||
+ 1; // "X tasks shown ..."
|
||||
maxlines -= table_header
|
||||
+ (context.verbose ("blank") ? 1 : 0)
|
||||
+ (context.verbose ("footnote") ? context.footnotes.size () : 0)
|
||||
+ (context.verbose ("affected") ? 1 : 0)
|
||||
+ context.config.getInteger ("reserved.lines"); // For prompt, etc.
|
||||
|
||||
// Render.
|
||||
std::stringstream out;
|
||||
|
@ -183,6 +185,7 @@ int CmdCustom::execute (std::string& output)
|
|||
rc = 1;
|
||||
}
|
||||
|
||||
feedback_backlog ();
|
||||
context.tdb2.commit ();
|
||||
output = out.str ();
|
||||
return rc;
|
||||
|
|
|
@ -178,6 +178,7 @@ int CmdShow::execute (std::string& output)
|
|||
" recurrence.indicator"
|
||||
" recurrence.limit"
|
||||
" regex"
|
||||
" reserved.lines"
|
||||
" row.padding"
|
||||
" rule.precedence.color"
|
||||
" search.case.sensitive"
|
||||
|
|
|
@ -60,6 +60,9 @@ int CmdSync::execute (std::string& output)
|
|||
|
||||
// Obtain credentials.
|
||||
std::string credentials_string = context.config.get ("taskd.credentials");
|
||||
if (credentials_string == "")
|
||||
throw std::string (STRING_CMD_SYNC_BAD_CRED);
|
||||
|
||||
std::vector <std::string> credentials;
|
||||
split (credentials, credentials_string, "/");
|
||||
if (credentials.size () != 3)
|
||||
|
|
|
@ -415,6 +415,25 @@ void feedback_unblocked (const Task& task)
|
|||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void feedback_backlog ()
|
||||
{
|
||||
if (context.config.get ("taskd.server") != "" &&
|
||||
context.verbose ("sync"))
|
||||
{
|
||||
std::vector <std::string> lines = context.tdb2.backlog.get_lines ();
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = lines.begin (); line != lines.end (); ++line)
|
||||
{
|
||||
if ((*line)[0] == '[')
|
||||
{
|
||||
context.footnote ("There are local changes. Sync required.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
std::string onProjectChange (Task& task, bool scope /* = true */)
|
||||
{
|
||||
|
|
|
@ -76,6 +76,7 @@ void feedback_affected (const std::string&, int);
|
|||
void feedback_affected (const std::string&, const Task&);
|
||||
void feedback_special_tags (const Task&, const std::string&);
|
||||
void feedback_unblocked (const Task&);
|
||||
void feedback_backlog ();
|
||||
std::string onProjectChange (Task&, bool scope = true);
|
||||
std::string onProjectChange (Task&, Task&);
|
||||
std::string onExpiration (Task&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue