mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
Enhancement
- When a .taskrc file is automatically generated, it is now nicely formatted, and filled with comments.
This commit is contained in:
parent
a23a350b8b
commit
8473227f52
2 changed files with 75 additions and 58 deletions
132
src/Config.cpp
132
src/Config.cpp
|
@ -99,128 +99,146 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
|
||||||
{
|
{
|
||||||
// Create a sample .taskrc file.
|
// Create a sample .taskrc file.
|
||||||
std::stringstream contents;
|
std::stringstream contents;
|
||||||
|
contents << "# Task program configuration file.\n"
|
||||||
contents << "# ...\n"
|
<< "# For more documentation, see http://taskwarrior.org\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
|
<< "# Files\n"
|
||||||
<< "data.location=" << data << "\n"
|
<< "data.location=" << data << "\n"
|
||||||
<< "confirmation=yes\n"
|
<< "locking=on # Use file-level locking\n"
|
||||||
<< "echo.command=yes\n"
|
|
||||||
<< "next=2\n"
|
|
||||||
<< "bulk=2\n"
|
|
||||||
<< "dateformat=m/d/Y\n"
|
|
||||||
<< "#monthsperline=2\n"
|
|
||||||
<< "#defaultwidth=80\n"
|
|
||||||
<< "curses=on\n"
|
|
||||||
<< "color=on\n"
|
|
||||||
<< "due=7\n"
|
|
||||||
<< "nag=You have higher priority tasks.\n"
|
|
||||||
<< "locking=on\n"
|
|
||||||
<< "#editor=vi\n"
|
|
||||||
<< "weekstart=Sunday\n"
|
|
||||||
<< "displayweeknumber=yes\n"
|
|
||||||
|
|
||||||
<< "color.overdue=bold_red\n"
|
|
||||||
<< "color.due=bold_yellow\n"
|
|
||||||
<< "color.pri.H=bold\n"
|
|
||||||
<< "#color.pri.M=on_yellow\n"
|
|
||||||
<< "#color.pri.L=on_green\n"
|
|
||||||
<< "#color.pri.none=white on_blue\n"
|
|
||||||
<< "color.active=bold_cyan\n"
|
|
||||||
<< "color.tagged=yellow\n"
|
|
||||||
<< "#color.tag.bug=yellow\n"
|
|
||||||
<< "#color.project.garden=on_green\n"
|
|
||||||
<< "#color.keyword.car=on_blue\n"
|
|
||||||
<< "#color.recurring=on_red\n"
|
|
||||||
<< "#color.header=bold_green\n"
|
|
||||||
<< "#color.footnote=bold_green\n"
|
|
||||||
<< "#color.message=bold_red\n"
|
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "# Shadow File Example\n"
|
<< "# Terminal\n"
|
||||||
<< "#shadow.file=" << data << "/shadow.txt\n"
|
<< "curses=on # Use curses\n"
|
||||||
<< "#shadow.command=list\n"
|
<< "#defaultwidth=80 # Without ncurses, assumed width\n"
|
||||||
<< "#shadow.notify=on\n"
|
<< "#editor=vi # Preferred text editor\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "#default.project=foo\n"
|
<< "# Miscellaneous\n"
|
||||||
<< "#default.priority=M\n"
|
<< "confirmation=yes # Confirmation on delete, big changes\n"
|
||||||
<< "default.command=list\n"
|
<< "echo.command=yes # Details on command just run\n"
|
||||||
|
<< "next=2 # How many tasks per project in next report\n"
|
||||||
// Custom reports.
|
<< "bulk=2 # > 2 tasks considered 'a lot', for confirmation\n"
|
||||||
<< "# Fields: id,uuid,project,priority,entry,start,due,recur,age,active,tags,description\n"
|
<< "nag=You have higher priority tasks. # Nag message to keep you honest\n"
|
||||||
<< "# description_only\n"
|
<< "\n"
|
||||||
|
<< "# Dates\n"
|
||||||
|
<< "dateformat=m/d/Y # Preferred input and display date format\n"
|
||||||
|
<< "weekstart=Sunday # Sunday or Monday only\n"
|
||||||
|
<< "displayweeknumber=yes # Show week numbers on calendar\n"
|
||||||
|
<< "due=7 # Task is considered due in 7 days\n"
|
||||||
|
<< "#monthsperline=2 # Number of calendar months on a line\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# Color controls.\n"
|
||||||
|
<< "color=on # Use color\n"
|
||||||
|
<< "color.overdue=bold_red # Color of overdue tasks\n"
|
||||||
|
<< "color.due=bold_yellow # Color of due tasks\n"
|
||||||
|
<< "color.pri.H=bold # Color of priority:H tasks\n"
|
||||||
|
<< "#color.pri.M=on_yellow # Color of priority:M tasks\n"
|
||||||
|
<< "#color.pri.L=on_green # Color of priority:L tasks\n"
|
||||||
|
<< "#color.pri.none=white on_blue # Color of priority: tasks\n"
|
||||||
|
<< "color.active=bold_cyan # Color of active tasks\n"
|
||||||
|
<< "color.tagged=yellow # Color of tagged tasks\n"
|
||||||
|
<< "#color.tag.bug=yellow # Color of +bug tasks\n"
|
||||||
|
<< "#color.project.garden=on_green # Color of project:garden tasks\n"
|
||||||
|
<< "#color.keyword.car=on_blue # Color of description.contains:car tasks\n"
|
||||||
|
<< "#color.recurring=on_red # Color of recur.any: tasks\n"
|
||||||
|
<< "#color.header=bold_green # Color of header messages\n"
|
||||||
|
<< "#color.footnote=bold_green # Color of footnote messages\n"
|
||||||
|
<< "\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 # Unless otherwise specified\n"
|
||||||
|
<< "#default.priority=M # Unless otherwise specified\n"
|
||||||
|
<< "default.command=list # Unless otherwise specified\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# Fields: id,uuid,project,priority,entry,start,due,recur,recur_ind,age,\n"
|
||||||
|
<< "# age_compact,active,tags,description,description_only\n"
|
||||||
<< "# Description: This report is ...\n"
|
<< "# Description: This report is ...\n"
|
||||||
<< "# Sort: due+,priority-,project+\n"
|
<< "# Sort: due+,priority-,project+\n"
|
||||||
<< "# Filter: pro:x pri:H +bug limit:10\n"
|
<< "# Filter: pro:x pri:H +bug limit:10\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task long\n"
|
||||||
<< "report.long.description=Lists all task, all data, matching the specified criteria\n"
|
<< "report.long.description=Lists all task, all data, matching the specified criteria\n"
|
||||||
<< "report.long.columns=id,project,priority,entry,start,due,recur,age,tags,description\n"
|
<< "report.long.columns=id,project,priority,entry,start,due,recur,age,tags,description\n"
|
||||||
<< "report.long.labels=ID,Project,Pri,Added,Started,Due,Recur,Age,Tags,Description\n"
|
<< "report.long.labels=ID,Project,Pri,Added,Started,Due,Recur,Age,Tags,Description\n"
|
||||||
<< "report.long.sort=due+,priority-,project+\n"
|
<< "report.long.sort=due+,priority-,project+\n"
|
||||||
<< "report.long.filter=status:pending\n"
|
<< "report.long.filter=status:pending\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task list\n"
|
||||||
<< "report.list.description=Lists all tasks matching the specified criteria\n"
|
<< "report.list.description=Lists all tasks matching the specified criteria\n"
|
||||||
<< "report.list.columns=id,project,priority,due,active,age,description\n"
|
<< "report.list.columns=id,project,priority,due,active,age,description\n"
|
||||||
<< "report.list.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
<< "report.list.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||||
<< "report.list.sort=due+,priority-,project+\n"
|
<< "report.list.sort=due+,priority-,project+\n"
|
||||||
<< "report.list.filter=status:pending\n"
|
<< "report.list.filter=status:pending\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task ls\n"
|
||||||
<< "report.ls.description=Minimal listing of all tasks matching the specified criteria\n"
|
<< "report.ls.description=Minimal listing of all tasks matching the specified criteria\n"
|
||||||
<< "report.ls.columns=id,project,priority,description\n"
|
<< "report.ls.columns=id,project,priority,description\n"
|
||||||
<< "report.ls.labels=ID,Project,Pri,Description\n"
|
<< "report.ls.labels=ID,Project,Pri,Description\n"
|
||||||
<< "report.ls.sort=priority-,project+\n"
|
<< "report.ls.sort=priority-,project+\n"
|
||||||
<< "report.ls.filter=status:pending\n"
|
<< "report.ls.filter=status:pending\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task newest\n"
|
||||||
<< "report.newest.description=Shows the newest tasks\n"
|
<< "report.newest.description=Shows the newest tasks\n"
|
||||||
<< "report.newest.columns=id,project,priority,due,active,age,description\n"
|
<< "report.newest.columns=id,project,priority,due,active,age,description\n"
|
||||||
<< "report.newest.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
<< "report.newest.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||||
<< "report.newest.sort=id-\n"
|
<< "report.newest.sort=id-\n"
|
||||||
<< "report.newest.filter=status:pending limit:10\n"
|
<< "report.newest.filter=status:pending limit:10\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task oldest\n"
|
||||||
<< "report.oldest.description=Shows the oldest tasks\n"
|
<< "report.oldest.description=Shows the oldest tasks\n"
|
||||||
<< "report.oldest.columns=id,project,priority,due,active,age,description\n"
|
<< "report.oldest.columns=id,project,priority,due,active,age,description\n"
|
||||||
<< "report.oldest.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
<< "report.oldest.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||||
<< "report.oldest.sort=id+\n"
|
<< "report.oldest.sort=id+\n"
|
||||||
<< "report.oldest.filter=status:pending limit:10\n"
|
<< "report.oldest.filter=status:pending limit:10\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task overdue\n"
|
||||||
<< "report.overdue.description=Lists overdue tasks matching the specified criteria\n"
|
<< "report.overdue.description=Lists overdue tasks matching the specified criteria\n"
|
||||||
<< "report.overdue.columns=id,project,priority,due,active,age,description\n"
|
<< "report.overdue.columns=id,project,priority,due,active,age,description\n"
|
||||||
<< "report.overdue.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
<< "report.overdue.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||||
<< "report.overdue.sort=due+,priority-,project+\n"
|
<< "report.overdue.sort=due+,priority-,project+\n"
|
||||||
<< "report.overdue.filter=status:pending due.before:today\n"
|
<< "report.overdue.filter=status:pending due.before:today\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task active\n"
|
||||||
<< "report.active.description=Lists active tasks matching the specified criteria\n"
|
<< "report.active.description=Lists active tasks matching the specified criteria\n"
|
||||||
<< "report.active.columns=id,project,priority,due,active,age,description\n"
|
<< "report.active.columns=id,project,priority,due,active,age,description\n"
|
||||||
<< "report.active.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
<< "report.active.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||||
<< "report.active.sort=due+,priority-,project+\n"
|
<< "report.active.sort=due+,priority-,project+\n"
|
||||||
<< "report.active.filter=status:pending start.any:\n"
|
<< "report.active.filter=status:pending start.any:\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task completed\n"
|
||||||
<< "report.completed.description=Lists completed tasks matching the specified criteria\n"
|
<< "report.completed.description=Lists completed tasks matching the specified criteria\n"
|
||||||
<< "report.completed.columns=end,project,priority,age,description\n"
|
<< "report.completed.columns=end,project,priority,age,description\n"
|
||||||
<< "report.completed.labels=Complete,Project,Pri,Age,Description\n"
|
<< "report.completed.labels=Complete,Project,Pri,Age,Description\n"
|
||||||
<< "report.completed.sort=end+,priority-,project+\n"
|
<< "report.completed.sort=end+,priority-,project+\n"
|
||||||
<< "report.completed.filter=status:completed\n"
|
<< "report.completed.filter=status:completed\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task recurring\n"
|
||||||
<< "report.recurring.description=Lists recurring tasks matching the specified criteria\n"
|
<< "report.recurring.description=Lists recurring tasks matching the specified criteria\n"
|
||||||
<< "report.recurring.columns=id,project,priority,due,recur,active,age,description\n"
|
<< "report.recurring.columns=id,project,priority,due,recur,active,age,description\n"
|
||||||
<< "report.recurring.labels=ID,Project,Pri,Due,Recur,Active,Age,Description\n"
|
<< "report.recurring.labels=ID,Project,Pri,Due,Recur,Active,Age,Description\n"
|
||||||
<< "report.recurring.sort=due+,priority-,project+\n"
|
<< "report.recurring.sort=due+,priority-,project+\n"
|
||||||
<< "report.recurring.filter=status:pending parent.any:\n"
|
<< "report.recurring.filter=status:pending parent.any:\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task waiting\n"
|
||||||
<< "report.waiting.description=Lists all waiting tasks matching the specified criteria\n"
|
<< "report.waiting.description=Lists all waiting tasks matching the specified criteria\n"
|
||||||
<< "report.waiting.columns=id,project,priority,wait,age,description\n"
|
<< "report.waiting.columns=id,project,priority,wait,age,description\n"
|
||||||
<< "report.waiting.labels=ID,Project,Pri,Wait,Age,Description\n"
|
<< "report.waiting.labels=ID,Project,Pri,Wait,Age,Description\n"
|
||||||
<< "report.waiting.sort=wait+,priority-,project+\n"
|
<< "report.waiting.sort=wait+,priority-,project+\n"
|
||||||
<< "report.waiting.filter=status:waiting\n"
|
<< "report.waiting.filter=status:waiting\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task all\n"
|
||||||
<< "report.all.description=Lists all tasks matching the specified criteria\n"
|
<< "report.all.description=Lists all tasks matching the specified criteria\n"
|
||||||
<< "report.all.columns=id,project,priority,due,active,age,description\n"
|
<< "report.all.columns=id,project,priority,due,active,age,description\n"
|
||||||
<< "report.all.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
<< "report.all.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||||
<< "report.all.sort=due+,priority-,project+\n"
|
<< "report.all.sort=due+,priority-,project+\n"
|
||||||
|
<< "\n"
|
||||||
|
<< "# task next\n"
|
||||||
<< "report.next.description=Lists all tasks matching the specified criteria\n"
|
<< "report.next.description=Lists all tasks matching the specified criteria\n"
|
||||||
<< "report.next.columns=id,project,priority,due,active,age,description\n"
|
<< "report.next.columns=id,project,priority,due,active,age,description\n"
|
||||||
<< "report.next.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
<< "report.next.labels=ID,Project,Pri,Due,Active,Age,Description\n"
|
||||||
<< "report.next.sort=due+,priority-,project+\n"
|
<< "report.next.sort=due+,priority-,project+\n"
|
||||||
<< "report.next.filter=status:pending\n";
|
<< "report.next.filter=status:pending\n"
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
spit (rc, contents.str ());
|
spit (rc, contents.str ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,7 +375,6 @@ void Context::loadCorrectConfigFile ()
|
||||||
}
|
}
|
||||||
|
|
||||||
args = filtered;
|
args = filtered;
|
||||||
exit (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue