PIT CLI agenda sorting, FileIssue bug fixed.

* Fixed the bug in FileIssue where it would append a blank line to the body of
  an issue every time it wrote the issue to the file. Fixed by making the
  parser consume a line break before the property section.
* Fixed PIT CLI -D option sorting of issues so that it will sort issues by
  priority, then due date.
This commit is contained in:
Jonathan Bernard 2011-12-19 16:19:07 -06:00
parent 0441f3c510
commit 85753de955
7 changed files with 22 additions and 13 deletions

View File

@ -1,11 +1,11 @@
#Mon, 19 Dec 2011 16:07:10 -0600
#Mon, 19 Dec 2011 16:21:52 -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=3
version=3.3.0
build.number=1
version=3.3.1
name=libpit
lib.dir=lib
lib.local=true

View File

@ -27,8 +27,8 @@ public class IssuePegParser extends BaseParser<Object> {
Rule PropertyBlock() {
return Sequence(push(makeNode()),
HorizontalRule(), OneOrMore(EOL), TableSeparator(), EOL,
OneOrMore(PropertyDefinition()), TableSeparator(),
EOL, HorizontalRule(), OneOrMore(EOL), TableSeparator(),
EOL, OneOrMore(PropertyDefinition()), TableSeparator(),
addToNode("extProperties", pop())); }
Rule PropertyDefinition() {

View File

@ -1,9 +1,9 @@
#Mon, 19 Dec 2011 16:07:16 -0600
#Mon, 19 Dec 2011 16:24:43 -0600
build.dir=build
src.dir=src
build.jar=pit-cli-${application.version}.${build.number}.jar
build.number=3
version=3.3.0
build.number=2
version=3.3.1
name=pit-cli
lib.dir=lib
lib.local=true

View File

@ -83,7 +83,7 @@ cli._(longOpt: 'version', 'Display PIT version information.')
// ======== Parse CLI Options ======== //
// =================================== //
def VERSION = "3.3.0"
def VERSION = "3.3.1"
def opts = cli.parse(args)
def issuedb = [:]
def workingDir = new File('.')
@ -245,6 +245,7 @@ if (opts.l) {
if (opts.v) {
println ""
issue.text.eachLine { println "${offset} ${it}" }
println ""
issue.extendedProperties.each { name, value ->
def formattedValue = ExtendedPropertyHelp.format(value)
println "${offset} * ${name}: ${formattedValue}"}
@ -315,6 +316,14 @@ else if (opts.D) {
if (issue.due) println "${issue.due.toString('EEE, MM/dd')} -- ${issue}"
else println " -- ${issue}" }
def priorityDateSorter = { i1, i2 ->
if (i1.priority == i2.priority) {
def d1 = i1.due ?: new DateTime()
def d2 = i2.due ?: new DateTime()
return d1.compareTo(d2) }
else { return i1.priority - i2.priority }}
// Sort the issues into seperate lists based on their due dates and
// reminders.
allIssues.each { issue ->
@ -338,7 +347,7 @@ else if (opts.D) {
println "Tasks Scheduled for Today"
println "-------------------------"
scheduledToday.each { printIssue(it) }
scheduledToday.sort(priorityDateSorter).each { printIssue(it) }
println "" }
@ -346,7 +355,7 @@ else if (opts.D) {
println "Tasks Due Today"
println "---------------"
dueToday.each { printIssue(it) }
dueToday.sort(priorityDateSorter).each { printIssue(it) }
println ""}
@ -354,7 +363,7 @@ else if (opts.D) {
println "Upcoming Tasks"
println "--------------"
reminderToday.each { printIssue(it) }
reminderToday.sort(priorityDateSorter).each { printIssue(it) }
println ""}
@ -362,7 +371,7 @@ else if (opts.D) {
println "Other Open Issues"
println "-----------------"
notDueOrReminder.each { printIssue(it) }
notDueOrReminder.sort(priorityDateSorter).each { printIssue(it) }
println "" }}

Binary file not shown.

Binary file not shown.

Binary file not shown.