3 Commits
v1.4 ... v1.6

Author SHA1 Message Date
b4e01b6098 done supports a list of actions, bugfix.
* `done` command now accepts an unlimited list of tasks to mark as done.
* `GTDCLI.stringToFilename` now removes forward slashes.
2013-10-30 11:31:28 -05:00
415c0e622f Fixed documentation typos, error code typos. 2013-10-28 12:25:22 -05:00
a9ba9d94f8 Bumped version number. 2013-10-21 14:08:58 +00:00
3 changed files with 55 additions and 47 deletions

View File

@ -1,8 +1,8 @@
#Mon, 21 Oct 2013 14:00:48 +0000
#Wed, 30 Oct 2013 10:46:52 -0500
lib.local=true
name=jdb-gtd
version=1.4
version=1.6
nailgun.classpath.dir=/home/jdbernard/programs/nailgun/classpath
executable.jar=true
main.class=com.jdblabs.gtd.cli.GTDCLI
build.number=1
build.number=0

View File

@ -23,7 +23,7 @@ import static com.jdblabs.gtd.Util.*
* @org gtd.jdb-labs.com/cli/GTDCLI */
public class GTDCLI {
public static final String VERSION = "1.3"
public static final String VERSION = "1.6"
private static String EOL = System.getProperty("line.separator")
/// We have a persistent instance when we are in the context of a Nailgun
@ -318,13 +318,20 @@ public class GTDCLI {
protected void done(LinkedList args) {
def selectedFilePath = args.poll()
def selectedFile = new File(selectedFilePath)
if (!selectedFile) {
if (!selectedFilePath) {
println "gtd done command requires a <action-file> parameter."
return }
while (selectedFilePath) {
def item
def selectedFile = new File(selectedFilePath)
if (!selectedFile.exists() || !selectedFile.isFile()) {
println "File does not exist or is a directory:"
println "\t" + selectedFile.canonicalPath
continue }
if (selectedFile.isAbsolute()) item = new Item(selectedFile)
else item = new Item(new File(workingDir, selectedFilePath))
@ -362,7 +369,8 @@ public class GTDCLI {
/// Delete the original
oldFile.delete()
println "'$item' marked as done." }
selectedFilePath = args.poll()
println "'$item' marked as done." } }
/** #### `calendar`
* Implement the `calendar` command to show all the items which are
@ -749,7 +757,7 @@ context or project is named, all contexts are listed."""
* palatable for a filename. */
public static String stringToFilename(String s) {
return s.replaceAll(/\s/, '-').
replaceAll(/[';:(\.$)]/, '').
replaceAll(/[';:(\.$\/)]/, '').
toLowerCase() }
}

View File

@ -120,7 +120,7 @@ public class GTDServlet extends HttpServlet {
/// Get this user's session
HttpSession session = request.getSession(true);
/// If the user is posting to `/gtd/login` then let's try to
/// If the user is posting to `/login` then let's try to
/// authenticate them. We don't care about the state of the existing
/// session.
if (request.servletPath == '/login') {
@ -161,8 +161,8 @@ public class GTDServlet extends HttpServlet {
/// Right now there is no other endpoint that supports `POST`, so return
/// `404 Not Found` or `405 Method Not Allowed`
switch (request.servletPath) {
case ~/\/gtd\/contexts.*/:
case ~/\/gtd\/projects.*/:
case ~/\/contexts.*/:
case ~/\/projects.*/:
response.status = SC_METHOD_NOT_ALLOWED
return
default:
@ -207,14 +207,14 @@ public class GTDServlet extends HttpServlet {
switch(request.servletPath) {
/// If they are invoking `/gtd/logout` then invalidate their session
/// If they are invoking `/logout` then invalidate their session
/// and return `200 OK`
case "/logout":
session.removeAttribute("authenticated")
session.invalidate()
break
/// ##### `/gtd/contexts`
/// ##### `/contexts`
/// Return the list of contexts that are readable by this user.
case "/contexts":
@ -230,7 +230,7 @@ public class GTDServlet extends HttpServlet {
writeJSON(returnData, response)
break
/// ##### `/gtd/contexts/<contextId>`
/// ##### `/contexts/<contextId>`
/// Return data for the requested context, assuming it is
/// readable for this user.
case ~'/contexts/(.+)':
@ -251,7 +251,7 @@ public class GTDServlet extends HttpServlet {
writeJSON(returnData, response)
break
/// ##### `/gtd/projects`
/// ##### `/projects`
/// Return the list of projects that are readable for this user.
case "/projects":
/// Filter the project directories to find the ones that the
@ -264,7 +264,7 @@ public class GTDServlet extends HttpServlet {
writeJSON(returnData, response)
break
/// ##### `/gtd/projects/<projectId>`
/// ##### `/projects/<projectId>`
/// Return data for the requested project, assuming it is readable
/// for this user.
case ~'/projects/(.+)':
@ -286,7 +286,7 @@ public class GTDServlet extends HttpServlet {
writeJSON(returnData, response)
break
/// ##### `/gtd/next-actions/<contexts-and-projects>`
/// ##### `/next-actions/<contexts-and-projects>`
/// Return all of the items contained in the named contexts and
/// projects, assuming the user has access to them.
/// `<contexts-and-projects>` is expected to be a comma-delimited