Merge branch '2.4.5' of ssh://git.tasktools.org/tm/task into 2.4.5

This commit is contained in:
Paul Beckingham 2015-06-07 09:47:15 -04:00
commit 490742284b
6 changed files with 63 additions and 21 deletions

View file

@ -18,6 +18,8 @@ Babej).
- Show the active context in "context list", if any is active. - Show the active context in "context list", if any is active.
- Fix "task edit" dropping annotation text after newlines. - Fix "task edit" dropping annotation text after newlines.
- Removed obsolete script 'context'. - Removed obsolete script 'context'.
- Fix "project" verbosity info not showing without "footnote" being manually
enabled.
------ current release --------------------------- ------ current release ---------------------------

View file

@ -275,6 +275,8 @@ control specific occasions when output is generated. This list may contain:
sync Feedback about sync sync Feedback about sync
filter Shows the filter used in the command filter Shows the filter used in the command
"affected", "new-id", "new-uuid" and "project" imply "footnote".
Note that the "on" setting is equivalent to all the tokens being specified, Note that the "on" setting is equivalent to all the tokens being specified,
and the "nothing" setting is equivalent to none of the tokens being specified. and the "nothing" setting is equivalent to none of the tokens being specified.

View file

@ -507,7 +507,7 @@ bool Context::color ()
// take the place of '0'. // take the place of '0'.
bool Context::verbose (const std::string& token) bool Context::verbose (const std::string& token)
{ {
if (! verbosity.size ()) if (verbosity.empty ())
{ {
verbosity_legacy = config.getBoolean ("verbose"); verbosity_legacy = config.getBoolean ("verbose");
split (verbosity, config.get ("verbose"), ','); split (verbosity, config.get ("verbose"), ',');
@ -516,24 +516,40 @@ bool Context::verbose (const std::string& token)
// This odd test is to see if a Boolean-false value is a real one, which // This odd test is to see if a Boolean-false value is a real one, which
// means it is not 1/true/T/yes/on, but also should not be one of the // means it is not 1/true/T/yes/on, but also should not be one of the
// valid tokens either. // valid tokens either.
if (!verbosity_legacy && if (!verbosity_legacy && ! verbosity.empty ())
verbosity.size () &&
verbosity[0] != "nothing" &&
verbosity[0] != "blank" && // This list must be complete.
verbosity[0] != "header" && //
verbosity[0] != "footnote" && //
verbosity[0] != "label" && //
verbosity[0] != "new-id" && //
verbosity[0] != "new-uuid" && //
verbosity[0] != "affected" && //
verbosity[0] != "edit" && //
verbosity[0] != "special" && //
verbosity[0] != "project" && //
verbosity[0] != "sync" && //
verbosity[0] != "filter") //
{ {
// This list emulates rc.verbose=off in version 1.9.4. std::string v = *(verbosity.begin ());
verbosity = {"blank", "label", "new-id", "edit"}; if (v != "nothing" &&
v != "blank" && // This list must be complete.
v != "header" && //
v != "footnote" && //
v != "label" && //
v != "new-id" && //
v != "new-uuid" && //
v != "affected" && //
v != "edit" && //
v != "special" && //
v != "project" && //
v != "sync" && //
v != "filter") //
{
// This list emulates rc.verbose=off in version 1.9.4.
verbosity = {"blank", "label", "new-id", "edit"};
}
}
// Some flags imply "footnote" verbosity being active. Make it so.
if (! verbosity.count ("footnote"))
{
// TODO: Some of these may not use footnotes yet. They should.
for (auto flag : {"affected", "new-id", "new-uuid", "project"})
{
if (verbosity.count (flag))
{
verbosity.insert ("footnote");
break;
}
}
} }
} }
@ -543,11 +559,11 @@ bool Context::verbose (const std::string& token)
// rc.verbose=nothing overrides all. // rc.verbose=nothing overrides all.
if (verbosity.size () == 1 && if (verbosity.size () == 1 &&
verbosity[0] == "nothing") *(verbosity.begin ()) == "nothing")
return false; return false;
// Specific token match. // Specific token match.
if (std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ()) if (verbosity.count (token))
return true; return true;
return false; return false;

View file

@ -37,6 +37,7 @@
#include <FS.h> #include <FS.h>
#include <CLI.h> #include <CLI.h>
#include <Timer.h> #include <Timer.h>
#include <set>
class Context class Context
{ {
@ -95,7 +96,7 @@ public:
bool run_gc; bool run_gc;
bool verbosity_legacy; bool verbosity_legacy;
std::vector <std::string> verbosity; std::set <std::string> verbosity;
std::vector <std::string> headers; std::vector <std::string> headers;
std::vector <std::string> footnotes; std::vector <std::string> footnotes;
std::vector <std::string> errors; std::vector <std::string> errors;

View file

@ -60,6 +60,25 @@ void wrapText (
lines.push_back (line); lines.push_back (line);
} }
////////////////////////////////////////////////////////////////////////////////
void split (
std::set<std::string>& results,
const std::string& input,
const char delimiter)
{
results.clear ();
std::string::size_type start = 0;
std::string::size_type i;
while ((i = input.find (delimiter, start)) != std::string::npos)
{
results.insert (input.substr (start, i - start));
start = i + 1;
}
if (input.length ())
results.insert (input.substr (start));
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void split ( void split (
std::vector<std::string>& results, std::vector<std::string>& results,

View file

@ -27,6 +27,7 @@
#ifndef INCLUDED_TEXT #ifndef INCLUDED_TEXT
#define INCLUDED_TEXT #define INCLUDED_TEXT
#include <set>
#include <string> #include <string>
#include <vector> #include <vector>
@ -39,6 +40,7 @@ std::string unquoteText (const std::string&);
int longestWord (const std::string&); int longestWord (const std::string&);
int longestLine (const std::string&); int longestLine (const std::string&);
bool extractLine (std::string&, const std::string&, int, bool, unsigned int&); bool extractLine (std::string&, const std::string&, int, bool, unsigned int&);
void split (std::set<std::string>&, const std::string&, const char);
void split (std::vector<std::string>&, const std::string&, const char); void split (std::vector<std::string>&, const std::string&, const char);
void split (std::vector<std::string>&, const std::string&, const std::string&); void split (std::vector<std::string>&, const std::string&, const std::string&);
void join (std::string&, const std::string&, const std::vector<std::string>&); void join (std::string&, const std::string&, const std::vector<std::string>&);