mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-09 18:50:39 +02:00
CmdTimesheet: Add ability to specify if context should be used
This makes timesheet consistent with other report commands.
This commit is contained in:
parent
ab29ef8326
commit
5309132add
2 changed files with 17 additions and 0 deletions
|
@ -53,6 +53,22 @@ CmdTimesheet::CmdTimesheet ()
|
|||
_category = Command::Category::report;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Whether a the timesheet uses context is defined by the
|
||||
// report.timesheet.context configuration variable.
|
||||
//
|
||||
bool CmdTimesheet::uses_context () const
|
||||
{
|
||||
auto config = Context::getContext ().config;
|
||||
auto key = "report.timesheet.context";
|
||||
|
||||
if (config.has (key))
|
||||
return config.getBoolean (key);
|
||||
else
|
||||
return _uses_context;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdTimesheet::execute (std::string& output)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ class CmdTimesheet : public Command
|
|||
public:
|
||||
CmdTimesheet ();
|
||||
int execute (std::string&);
|
||||
bool uses_context () const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue