mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Shadow Files
- Removed the shadow file feature, which has caused much suffering since version 1.4.3.
This commit is contained in:
parent
7fdac6a09e
commit
150f72eed4
8 changed files with 7 additions and 182 deletions
|
@ -276,11 +276,6 @@ std::string Config::_defaults =
|
|||
"# and any trailing '.value'.\n"
|
||||
"rule.precedence.color=due.today,active,blocking,blocked,overdue,due,scheduled,keyword.,project.,tag.,uda.,recurring,pri.,tagged,completed,deleted\n"
|
||||
"\n"
|
||||
"# Shadow file support\n"
|
||||
"#shadow.file=/tmp/shadow.txt # Location of shadow file\n"
|
||||
"#shadow.command=list # Task command for shadow file\n"
|
||||
"#shadow.notify=on # Footnote when updated\n"
|
||||
"\n"
|
||||
"#default.project=foo # Default project for 'add' command\n"
|
||||
"#default.priority=M # Default priority for 'add' command\n"
|
||||
"#default.due=eom # Default due date for 'add' command\n"
|
||||
|
|
|
@ -406,13 +406,7 @@ int Context::dispatch (std::string &out)
|
|||
throw std::string ("");
|
||||
*/
|
||||
|
||||
int rc = c->execute (out);
|
||||
|
||||
// Write commands cause an update of the shadow file, if configured.
|
||||
if (! c->read_only ())
|
||||
shadow ();
|
||||
|
||||
return rc;
|
||||
return c->execute (out);
|
||||
}
|
||||
|
||||
assert (commands["help"]);
|
||||
|
@ -521,59 +515,6 @@ bool Context::verbose (const std::string& token)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This needs to be taken out and shot, as soon as hooks will allow.
|
||||
void Context::shadow ()
|
||||
{
|
||||
std::string file_name = config.get ("shadow.file");
|
||||
std::string command = config.get ("shadow.command");
|
||||
std::string rcfile = rc_file;
|
||||
|
||||
// A missing shadow file command uses the default command instead.
|
||||
if (command == "")
|
||||
command = config.get ("default.command");
|
||||
|
||||
if (file_name != "" &&
|
||||
command != "")
|
||||
{
|
||||
File shadow_file (file_name);
|
||||
|
||||
// Check for dangerous shadow file settings.
|
||||
std::string location = config.get ("data.location");
|
||||
if (shadow_file._data == location + "/pending.data")
|
||||
throw std::string (STRING_CONTEXT_SHADOW_P);
|
||||
|
||||
if (shadow_file._data == location + "/completed.data")
|
||||
throw std::string (STRING_CONTEXT_SHADOW_C);
|
||||
|
||||
if (shadow_file._data == location + "/undo.data")
|
||||
throw std::string (STRING_CONTEXT_SHADOW_U);
|
||||
|
||||
if (shadow_file._data == location + "/backlog.data")
|
||||
throw std::string (STRING_CONTEXT_SHADOW_B);
|
||||
|
||||
// Compose the command. Put the rc overrides up front, so that they may
|
||||
// be overridden by rc.shadow.command.
|
||||
command = program +
|
||||
" rc.detection:off" + // No need to determine terminal size
|
||||
" rc.color:off" + // Color off by default
|
||||
" rc.gc:off " + // GC off, to reduce headaches
|
||||
" rc.locking:off" + // No file locking
|
||||
" rc:" + rcfile + " " + // Use specified rc file
|
||||
command + // User specified command
|
||||
" >" + // Capture
|
||||
shadow_file._data; // User specified file
|
||||
|
||||
debug ("Running shadow command: " + command);
|
||||
system (command.c_str ());
|
||||
|
||||
// Optionally display a notification that the shadow file was updated.
|
||||
// TODO Convert to a verbosity token.
|
||||
if (config.getBoolean ("shadow.notify"))
|
||||
footnote (format (STRING_CONTEXT_SHADOW_UPDATE, shadow_file._data));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::vector <std::string> Context::getColumns () const
|
||||
{
|
||||
|
|
|
@ -52,7 +52,6 @@ public:
|
|||
int initialize (int, const char**); // all startup
|
||||
int run ();
|
||||
int dispatch (std::string&); // command handler dispatch
|
||||
void shadow (); // shadow file update
|
||||
|
||||
int getWidth (); // determine terminal width
|
||||
int getHeight (); // determine terminal height
|
||||
|
|
|
@ -175,9 +175,6 @@ int CmdShow::execute (std::string& output)
|
|||
" row.padding"
|
||||
" rule.precedence.color"
|
||||
" search.case.sensitive"
|
||||
" shadow.command"
|
||||
" shadow.file"
|
||||
" shadow.notify"
|
||||
" shell.prompt"
|
||||
" tag.indicator"
|
||||
" taskd.server"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue