From 0441f3c5105638a847e049986617776caa5df025 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Mon, 19 Dec 2011 16:08:09 -0600 Subject: [PATCH] Added -R option for PIT CLI. --- issues/libpit/{0000bn5.rst => 0000bs5.rst} | 8 +++-- libpit/build.xml | 4 +++ libpit/project.properties | 4 +-- pit-cli/build.xml | 4 +++ pit-cli/project.properties | 6 ++-- .../pit/PersonalIssueTrackerCLI.groovy | 29 +++++++++++++------ 6 files changed, 38 insertions(+), 17 deletions(-) rename issues/libpit/{0000bn5.rst => 0000bs5.rst} (70%) diff --git a/issues/libpit/0000bn5.rst b/issues/libpit/0000bs5.rst similarity index 70% rename from issues/libpit/0000bn5.rst rename to issues/libpit/0000bs5.rst index f285a2e..11e6e5d 100644 --- a/issues/libpit/0000bn5.rst +++ b/issues/libpit/0000bs5.rst @@ -4,8 +4,10 @@ FileIssue is not formatting output in the same way it parses input. `FileIssue.formatIssue(Issue)` introduces at least one extra line to the end of the issue body compared to what is parsed in using the PegParser. + ---- -======== =================== -Created: 2011-12-18T22:53:45 -======== =================== +========= =================== +Created : 2011-12-18T22:53:45 +Resolved: 2011-12-19T16:09:50 +========= =================== diff --git a/libpit/build.xml b/libpit/build.xml index 4a0c537..707f4d0 100755 --- a/libpit/build.xml +++ b/libpit/build.xml @@ -11,6 +11,10 @@ + + + + + + + + diff --git a/pit-cli/project.properties b/pit-cli/project.properties index b7925da..5b48ad1 100755 --- a/pit-cli/project.properties +++ b/pit-cli/project.properties @@ -1,9 +1,9 @@ -#Sun, 11 Dec 2011 21:04:03 -0600 +#Mon, 19 Dec 2011 16:07:16 -0600 build.dir=build src.dir=src build.jar=pit-cli-${application.version}.${build.number}.jar -build.number=2 -version=3.2.3 +build.number=3 +version=3.3.0 name=pit-cli lib.dir=lib lib.local=true diff --git a/pit-cli/src/main/com/jdbernard/pit/PersonalIssueTrackerCLI.groovy b/pit-cli/src/main/com/jdbernard/pit/PersonalIssueTrackerCLI.groovy index 17bf206..3c4e582 100644 --- a/pit-cli/src/main/com/jdbernard/pit/PersonalIssueTrackerCLI.groovy +++ b/pit-cli/src/main/com/jdbernard/pit/PersonalIssueTrackerCLI.groovy @@ -13,8 +13,7 @@ import static java.lang.Math.min def cli = new CliBuilder(usage: 'pit-cli [options]') cli.h(longOpt: 'help', 'Show help information.') cli.v(longOpt: 'verbose', 'Show verbose task information') -cli.l(longOpt: 'list', 'List issues. Unless otherwise specified it lists all ' - + 'sub projects and all unclosed issue categories.') +cli.l(longOpt: 'list', 'List issues in the current project.') cli.i(argName: 'id', longOpt: 'id', args: 1, 'Filter issues by id. Accepts a comma-delimited list.') cli.c(argName: 'category', longOpt: 'category', args: 1, @@ -29,6 +28,7 @@ cli.p(argName: 'priority', longOpt: 'priority', args: 1, cli.r(argName: 'project', longOpt: 'project', args: 1, 'Filter issues by project (relative to the current directory). Accepts a ' + 'comma-delimited list.') +cli.R(longOpt: 'recursive', 'Include subprojects.') cli.e(argName: 'extended-property', args: 1, 'Filter for issues by extended ' + 'property. Format is "-e =".') /*cli.s(longOpt: 'show-subprojects', @@ -83,7 +83,7 @@ cli._(longOpt: 'version', 'Display PIT version information.') // ======== Parse CLI Options ======== // // =================================== // -def VERSION = "3.2.3" +def VERSION = "3.3.0" def opts = cli.parse(args) def issuedb = [:] def workingDir = new File('.') @@ -260,8 +260,10 @@ if (opts.l) { // print all the issues in the root of this db issuedb.eachIssue(filter) { printIssue(it, "") } - // print all projects - issuedb.eachProject(filter) { printProject(it, "") } } + + if (opts.R) { + // print all projects + issuedb.eachProject(filter) { printProject(it, "") }} } // daily list second else if (opts.D) { @@ -294,7 +296,11 @@ else if (opts.D) { if (!opts.o) { filter.issueSorter = [ {it.due}, {it.priority}, {it.id} ] } // Get our issues - def allIssues = issuedb.getAllIssues(filter) + def allIssues = opts.R ? + // If -R passed, get all issues, including subprojects. + issuedb.getAllIssues(filter) : + // Otherwise, just use the issues for this project. + issuedb.issues.values().findAll { filter ? filter.accept(it) : true } // Set up our time interval. def today = new DateMidnight() @@ -430,11 +436,16 @@ else if (assignOpts.size() > 0) { case Status.REJECTED: assignOpts.rejected = new DateTime(); break default: break }} - issuedb.walkProject(filter) { issue -> + def processIssue = { issue -> println issue assignOpts.each { propName, value -> issue[propName] = value def formattedValue = ExtendedPropertyHelp.format(value) - println " set ${propName} to ${formattedValue}" } }} - + println " set ${propName} to ${formattedValue}" } } + + if (opts.R) { issuedb.walkProject(filter, processIssue) } + else { + issuedb.issues.values() + .findAll { filter ? filter.accept(it) : true } + .each(processIssue) }} else { cli.usage(); return -1 }}