mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-18 15:33:08 +02:00
CmdCustom: Respect report.<name>.context configuration variable
This allows the user to configure if a specific report should (or should not) adhere to the currently active context. Closes #2560.
This commit is contained in:
parent
c195c59494
commit
ab29ef8326
3 changed files with 17 additions and 1 deletions
|
@ -59,6 +59,21 @@ CmdCustom::CmdCustom (
|
||||||
_category = Category::report;
|
_category = Category::report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Whether a report uses context is defined by the report.<name>.context
|
||||||
|
// configuration variable.
|
||||||
|
//
|
||||||
|
bool CmdCustom::uses_context () const
|
||||||
|
{
|
||||||
|
auto config = Context::getContext ().config;
|
||||||
|
auto key = "report." + _keyword + ".context";
|
||||||
|
|
||||||
|
if (config.has (key))
|
||||||
|
return config.getBoolean (key);
|
||||||
|
else
|
||||||
|
return _uses_context;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int CmdCustom::execute (std::string& output)
|
int CmdCustom::execute (std::string& output)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,7 @@ class CmdCustom : public Command
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CmdCustom (const std::string&, const std::string&, const std::string&);
|
CmdCustom (const std::string&, const std::string&, const std::string&);
|
||||||
|
bool uses_context () const override;
|
||||||
int execute (std::string&);
|
int execute (std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
bool read_only () const;
|
bool read_only () const;
|
||||||
bool displays_id () const;
|
bool displays_id () const;
|
||||||
bool needs_gc () const;
|
bool needs_gc () const;
|
||||||
bool uses_context () const;
|
virtual bool uses_context () const;
|
||||||
bool accepts_filter () const;
|
bool accepts_filter () const;
|
||||||
bool accepts_modifications () const;
|
bool accepts_modifications () const;
|
||||||
bool accepts_miscellaneous () const;
|
bool accepts_miscellaneous () const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue