|
|
|
@ -10,7 +10,7 @@ import org.joda.time.DateTime
|
|
|
|
|
|
|
|
|
|
public class GTDCLI {
|
|
|
|
|
|
|
|
|
|
public static final String VERSION = "0.9"
|
|
|
|
|
public static final String VERSION = "1.1"
|
|
|
|
|
private static String EOL = System.getProperty("line.separator")
|
|
|
|
|
private static GTDCLI nailgunInst
|
|
|
|
|
|
|
|
|
@ -98,6 +98,7 @@ public class GTDCLI {
|
|
|
|
|
case ~/list-copies/: listCopies(parsedArgs); break
|
|
|
|
|
case ~/new/: newAction(parsedArgs); break
|
|
|
|
|
case ~/tickler/: tickler(parsedArgs); break
|
|
|
|
|
case ~/ls|list/: ls(parsedArgs); break;
|
|
|
|
|
default:
|
|
|
|
|
println "Unrecognized command: ${command}"
|
|
|
|
|
break } } }
|
|
|
|
@ -377,6 +378,36 @@ public class GTDCLI {
|
|
|
|
|
item.save()
|
|
|
|
|
oldFile.delete() }}}
|
|
|
|
|
|
|
|
|
|
protected void ls(LinkedList args) {
|
|
|
|
|
|
|
|
|
|
def target = args.poll()
|
|
|
|
|
|
|
|
|
|
def printItems = { dir ->
|
|
|
|
|
if (!dir.exists() || !dir.isDirectory()) return
|
|
|
|
|
println "-- ${getRelativePath(gtdDirs.root, dir)} --"
|
|
|
|
|
dir.eachFile { file ->
|
|
|
|
|
if (!file.exists() || !file.isFile() || file.isHidden())
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
def item = new Item(file)
|
|
|
|
|
println item.action }
|
|
|
|
|
|
|
|
|
|
println "" }
|
|
|
|
|
|
|
|
|
|
// If we have a named context or project, look for those items
|
|
|
|
|
// specifically
|
|
|
|
|
if (target) {
|
|
|
|
|
|
|
|
|
|
printItems(new File(gtdDirs['next-actions'], target))
|
|
|
|
|
printItems(new File(gtdDirs.waiting, target))
|
|
|
|
|
printItems(new File(gtdDirs.projects, target)) }
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
printItems(gtdDirs['next-actions'])
|
|
|
|
|
printItems(gtdDirs['waiting'])
|
|
|
|
|
gtdDirs['next-actions'].eachDir(printItems)
|
|
|
|
|
gtdDirs['waiting'].eachDir(printItems) } }
|
|
|
|
|
|
|
|
|
|
protected void printUsage(LinkedList args) {
|
|
|
|
|
|
|
|
|
|
if (!args) {
|
|
|
|
@ -497,6 +528,14 @@ This command should be scheduled for execution once a day. It checks the tickler
|
|
|
|
|
file for any items that should become active (based on their <tickle> property)
|
|
|
|
|
and moves them out of the tickler file and into the next-actions file."""
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case ~/ls|list-context/: println """\
|
|
|
|
|
usage gtd ls [<context> ...]
|
|
|
|
|
|
|
|
|
|
This command lists all the tasks for a given context or project. The purpose is
|
|
|
|
|
to list in one place items that are sitting in the next-actions folder or the
|
|
|
|
|
waiting folder for a specific context or list items for a given project. If no
|
|
|
|
|
context or project is named, all contexts are listed."""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -531,7 +570,7 @@ and moves them out of the tickler file and into the next-actions file."""
|
|
|
|
|
// parent path.
|
|
|
|
|
return true }
|
|
|
|
|
|
|
|
|
|
protected String getRelativePath(File parent, File child) {
|
|
|
|
|
protected static String getRelativePath(File parent, File child) {
|
|
|
|
|
def parentPath = parent.canonicalPath.split("/")
|
|
|
|
|
def childPath = child.canonicalPath.split("/")
|
|
|
|
|
|
|
|
|
|