Added --version flag to pit-cli. Bugfix in FileRepository

* `FileRepository` was incorrectly returning the root project's first
  set of subprojects for the `getRootProjects()` function, instead of the root
  project itself.
This commit is contained in:
Jonathan Bernard 2011-10-25 11:33:06 -05:00
parent 09319cb2e7
commit 5effdea201
5 changed files with 16 additions and 6 deletions

View File

@ -13,7 +13,7 @@ public class FileRepository extends Repository {
public void persist() {} // nothing to do
public Project[] getRootProjects() {
return fileProject.proejcts.values() as Project[]
return [fileProject] as Project[]
}
public FileProject createNewProject(String name) {

1
pit-cli/.gitignore vendored
View File

@ -1,2 +1,3 @@
release/
build/
*.sw?

View File

@ -1,8 +1,8 @@
#Fri, 21 Oct 2011 16:19:53 -0500
#Tue, 25 Oct 2011 11:32:31 -0500
build.dir=build
src.dir=src
build.jar=pit-cli-${application.version}.${build.number}.jar
build.number=9
build.number=13
expected.application.version=2.6.0
lib.dir=lib
release.dir=release

Binary file not shown.

View File

@ -38,8 +38,10 @@ cli.S(argName: 'new-status', longOpt: 'set-status', args: 1,
cli.n(longOpt: 'new-issue', 'Create a new issue.')
cli.d(longOpt: 'dir', argName: 'dir', args: 1, required: false,
'Use <dir> as the base directory (defaults to current directory).')
cli._(longOpt: 'version', 'Display PIT version information.')
// -------- parse CLI options -------- //
def VERSION = "2.6.0"
def opts = cli.parse(args)
def issuedb = [:]
def workingDir = new File('.')
@ -156,8 +158,15 @@ issuedb = new FileProject(workingDir)
// build filter from options
def filter = new Filter(selectOpts)
// list first
if (opts.l) {
// -------- Actions -------- //
// list version information first
if (opts.version) {
println "PIT CLI Version ${VERSION}"
println "Written by Jonathan Bernard\n" }
// list second
else if (opts.l) {
// local function (closure) to print a single issue
def printIssue = { issue, offset ->
@ -180,7 +189,7 @@ if (opts.l) {
// print all projects
issuedb.eachProject(filter) { printProject(it, "") } }
// new issues second
// new issues third
else if (opts.n) {
def cat, priority
String text = ""