mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CmdInfo: Migrated from ViewText to Table
This commit is contained in:
parent
dc851fe4b2
commit
79c1a94289
2 changed files with 24 additions and 16 deletions
|
@ -99,10 +99,12 @@ int CmdInfo::execute (std::string& output)
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
for (auto& task : filtered)
|
for (auto& task : filtered)
|
||||||
{
|
{
|
||||||
ViewText view;
|
Table view;
|
||||||
view.width (context.getWidth ());
|
view.width (context.getWidth ());
|
||||||
view.add (Column::factory ("string", STRING_COLUMN_LABEL_NAME));
|
if (context.config.getBoolean ("obfuscate"))
|
||||||
view.add (Column::factory ("string", STRING_COLUMN_LABEL_VALUE));
|
view.obfuscate ();
|
||||||
|
view.add (STRING_COLUMN_LABEL_NAME);
|
||||||
|
view.add (STRING_COLUMN_LABEL_VALUE);
|
||||||
|
|
||||||
// If an alternating row color is specified, notify the table.
|
// If an alternating row color is specified, notify the table.
|
||||||
if (context.color ())
|
if (context.color ())
|
||||||
|
@ -407,7 +409,7 @@ int CmdInfo::execute (std::string& output)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a second table, containing urgency details, if necessary.
|
// Create a second table, containing urgency details, if necessary.
|
||||||
ViewText urgencyDetails;
|
Table urgencyDetails;
|
||||||
if (task.urgency () != 0.0)
|
if (task.urgency () != 0.0)
|
||||||
{
|
{
|
||||||
if (context.color ())
|
if (context.color ())
|
||||||
|
@ -420,13 +422,16 @@ int CmdInfo::execute (std::string& output)
|
||||||
urgencyDetails.colorHeader (label);
|
urgencyDetails.colorHeader (label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context.config.getBoolean ("obfuscate"))
|
||||||
|
urgencyDetails.obfuscate ();
|
||||||
|
|
||||||
urgencyDetails.width (context.getWidth ());
|
urgencyDetails.width (context.getWidth ());
|
||||||
urgencyDetails.add (Column::factory ("string", "")); // Attribute
|
urgencyDetails.add (""); // Attribute
|
||||||
urgencyDetails.add (Column::factory ("string", "")); // Value
|
urgencyDetails.add (""); // Value
|
||||||
urgencyDetails.add (Column::factory ("string", "")); // *
|
urgencyDetails.add (""); // *
|
||||||
urgencyDetails.add (Column::factory ("string", "")); // Coefficient
|
urgencyDetails.add (""); // Coefficient
|
||||||
urgencyDetails.add (Column::factory ("string", "")); // =
|
urgencyDetails.add (""); // =
|
||||||
urgencyDetails.add (Column::factory ("string", "")); // Result
|
urgencyDetails.add (""); // Result
|
||||||
|
|
||||||
urgencyTerm (urgencyDetails, "project", task.urgency_project (), Task::urgencyProjectCoefficient);
|
urgencyTerm (urgencyDetails, "project", task.urgency_project (), Task::urgencyProjectCoefficient);
|
||||||
urgencyTerm (urgencyDetails, "active", task.urgency_active (), Task::urgencyActiveCoefficient);
|
urgencyTerm (urgencyDetails, "active", task.urgency_active (), Task::urgencyActiveCoefficient);
|
||||||
|
@ -506,7 +511,7 @@ int CmdInfo::execute (std::string& output)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a third table, containing undo log change details.
|
// Create a third table, containing undo log change details.
|
||||||
ViewText journal;
|
Table journal;
|
||||||
|
|
||||||
// If an alternating row color is specified, notify the table.
|
// If an alternating row color is specified, notify the table.
|
||||||
if (context.color ())
|
if (context.color ())
|
||||||
|
@ -519,9 +524,12 @@ int CmdInfo::execute (std::string& output)
|
||||||
journal.colorHeader (label);
|
journal.colorHeader (label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context.config.getBoolean ("obfuscate"))
|
||||||
|
journal.obfuscate ();
|
||||||
|
|
||||||
journal.width (context.getWidth ());
|
journal.width (context.getWidth ());
|
||||||
journal.add (Column::factory ("string", STRING_COLUMN_LABEL_DATE));
|
journal.add (STRING_COLUMN_LABEL_DATE);
|
||||||
journal.add (Column::factory ("string", STRING_CMD_INFO_MODIFICATION));
|
journal.add (STRING_CMD_INFO_MODIFICATION);
|
||||||
|
|
||||||
if (context.config.getBoolean ("journal.info") &&
|
if (context.config.getBoolean ("journal.info") &&
|
||||||
undo.size () > 3)
|
undo.size () > 3)
|
||||||
|
@ -577,7 +585,7 @@ int CmdInfo::execute (std::string& output)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CmdInfo::urgencyTerm (
|
void CmdInfo::urgencyTerm (
|
||||||
ViewText& view,
|
Table& view,
|
||||||
const std::string& label,
|
const std::string& label,
|
||||||
float measure,
|
float measure,
|
||||||
float coefficient) const
|
float coefficient) const
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <Command.h>
|
#include <Command.h>
|
||||||
#include <ViewText.h>
|
#include <Table.h>
|
||||||
|
|
||||||
class CmdInfo : public Command
|
class CmdInfo : public Command
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ public:
|
||||||
int execute (std::string&);
|
int execute (std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void urgencyTerm (ViewText&, const std::string&, float, float) const;
|
void urgencyTerm (Table&, const std::string&, float, float) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue