Bugfixes on pit-cli:
* Fixed a bug in the option parsing. When no options (or unknown options) where presented it was not properly defaulting. * Fixed a bug when incorrect options where given. Apache Commons CLI fails entirely when it is unable to parse an option. This means we cannot get the `--dir` option and we default to the program's working directory. When running on Nailgun this is not the desired behavior and can cause pit to look through a very deep file heirarchy to find issues.
This commit is contained in:
parent
85753de955
commit
c0b02ca222
@ -1,11 +1,11 @@
|
||||
#Mon, 19 Dec 2011 16:21:52 -0600
|
||||
#Mon, 13 Feb 2012 10:13:41 -0600
|
||||
#Sat Apr 24 17:08:00 CDT 2010
|
||||
build.dir=build
|
||||
src.dir=src
|
||||
lib.shared.dir=../shared-libs
|
||||
test.dir=test
|
||||
build.number=1
|
||||
version=3.3.1
|
||||
version=3.3.2
|
||||
name=libpit
|
||||
lib.dir=lib
|
||||
lib.local=true
|
||||
|
BIN
pit-cli/lib/compile/jar/slf4j-api-1.6.1.jar
Normal file
BIN
pit-cli/lib/compile/jar/slf4j-api-1.6.1.jar
Normal file
Binary file not shown.
BIN
pit-cli/lib/runtime/jar/logback-classic-0.9.26.jar
Normal file
BIN
pit-cli/lib/runtime/jar/logback-classic-0.9.26.jar
Normal file
Binary file not shown.
BIN
pit-cli/lib/runtime/jar/logback-core-0.9.26.jar
Normal file
BIN
pit-cli/lib/runtime/jar/logback-core-0.9.26.jar
Normal file
Binary file not shown.
BIN
pit-cli/lib/runtime/jar/slf4j-api-1.6.1.jar
Normal file
BIN
pit-cli/lib/runtime/jar/slf4j-api-1.6.1.jar
Normal file
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
#Mon, 19 Dec 2011 16:24:43 -0600
|
||||
#Mon, 13 Feb 2012 10:46:15 -0600
|
||||
build.dir=build
|
||||
src.dir=src
|
||||
build.jar=pit-cli-${application.version}.${build.number}.jar
|
||||
build.number=2
|
||||
version=3.3.1
|
||||
build.number=5
|
||||
version=3.3.2
|
||||
name=pit-cli
|
||||
lib.dir=lib
|
||||
lib.local=true
|
||||
|
@ -4,10 +4,13 @@ import com.jdbernard.pit.file.*
|
||||
|
||||
import org.joda.time.DateMidnight
|
||||
import org.joda.time.DateTime
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
import static java.lang.Math.max
|
||||
import static java.lang.Math.min
|
||||
|
||||
def log = LoggerFactory.getLogger(getClass())
|
||||
|
||||
// -------- command-line interface specification -------- //
|
||||
|
||||
def cli = new CliBuilder(usage: 'pit-cli [options]')
|
||||
@ -83,7 +86,9 @@ cli._(longOpt: 'version', 'Display PIT version information.')
|
||||
// ======== Parse CLI Options ======== //
|
||||
// =================================== //
|
||||
|
||||
def VERSION = "3.3.1"
|
||||
log.trace("Parsing options.")
|
||||
|
||||
def VERSION = "3.3.2"
|
||||
def opts = cli.parse(args)
|
||||
def issuedb = [:]
|
||||
def workingDir = new File('.')
|
||||
@ -102,9 +107,7 @@ def selectOpts = [
|
||||
// options for changing properties of issue(s)
|
||||
def assignOpts = [:]
|
||||
|
||||
if (!opts) opts.l = true; // default to 'list'
|
||||
|
||||
if (opts.h) {
|
||||
if (!opts || opts.h) {
|
||||
cli.usage()
|
||||
System.exit(0) }
|
||||
|
||||
@ -217,6 +220,8 @@ if (opts.d) {
|
||||
|
||||
def EOL = System.getProperty('line.separator')
|
||||
|
||||
log.debug("Finished parsing options:\nworkingDir: {}\nselectOpts: {}\nassignOpts: {}",
|
||||
workingDir.canonicalPath, selectOpts, assignOpts)
|
||||
|
||||
// ========================= //
|
||||
// ======== Actions ======== //
|
||||
@ -231,14 +236,18 @@ if (opts.version) {
|
||||
else {
|
||||
|
||||
// build issue list
|
||||
log.trace("Building issue database.")
|
||||
issuedb = new FileProject(workingDir)
|
||||
|
||||
// build filter from options
|
||||
log.trace("Defining the filter.")
|
||||
def filter = new Filter(selectOpts)
|
||||
|
||||
// list second
|
||||
if (opts.l) {
|
||||
|
||||
log.trace("Listing issues.")
|
||||
|
||||
// local function (closure) to print a single issue
|
||||
def printIssue = { issue, offset ->
|
||||
println "${offset}${issue}"
|
||||
@ -269,6 +278,8 @@ if (opts.l) {
|
||||
// daily list second
|
||||
else if (opts.D) {
|
||||
|
||||
log.trace("Showing a daily list.")
|
||||
|
||||
// Parse daily list specific display options
|
||||
def visibleSections = []
|
||||
def suppressedSections
|
||||
@ -377,6 +388,9 @@ else if (opts.D) {
|
||||
|
||||
// new issues fourth
|
||||
else if (opts.n) {
|
||||
|
||||
log.trace("Creating a new issue.")
|
||||
|
||||
Issue issue
|
||||
def sin = System.in.newReader()
|
||||
|
||||
@ -438,6 +452,8 @@ else if (opts.n) {
|
||||
// last, changes to existing issues
|
||||
else if (assignOpts.size() > 0) {
|
||||
|
||||
log.trace("Changing existing issues.")
|
||||
|
||||
// We are going to add some extra properties if the status is being changed,
|
||||
// because we are nice like that.
|
||||
if (assignOpts.status) { switch (assignOpts.status) {
|
||||
@ -457,4 +473,6 @@ else if (assignOpts.size() > 0) {
|
||||
issuedb.issues.values()
|
||||
.findAll { filter ? filter.accept(it) : true }
|
||||
.each(processIssue) }}
|
||||
else { cli.usage(); return -1 }}
|
||||
else {
|
||||
log.trace("Unknown request.")
|
||||
cli.usage(); return -1 }}
|
||||
|
@ -1 +1 @@
|
||||
application.version=3.0.0
|
||||
application.version=3.3.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user