parsing todo.txt done

This commit is contained in:
jamesclonk@jamesclonk.ch
2014-01-03 20:00:40 +01:00
parent 510c61ffb3
commit 6d32f8e493
7 changed files with 601 additions and 264 deletions

21
testdata/example.go vendored Normal file
View File

@@ -0,0 +1,21 @@
package main
import (
"fmt"
"github.com/JamesClonk/go-todotxt"
"log"
)
func main() {
todotxt.IgnoreComments = false
tasklist, err := todotxt.LoadFromFilename("../todo.txt")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Task 2, todo: %v\n", tasklist[1].Todo)
fmt.Printf("Task 3: %v\n", tasklist[2])
fmt.Printf("Task 4, has priority: %v\n\n", tasklist[3].HasPriority())
fmt.Print(tasklist)
}

View File

@@ -1,10 +1,38 @@
(A) 2012-01-30 Call Mom @Call @Phone +Family
(A) Schedule annual checkup +Health
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
(C) Add cover sheets @Office +TPSReports
Plan backyard herb garden @Home +Gardening +Improving +Planning
2013-02-22 Pick up milk @GroceryStore
Research self-publishing services +Novel due:2014-01-01
x Download Todo.txt mobile app @Phone
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todotxt
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
x (C) 2014-01-01 Create golang library documentation @Go +go-todotxt due:2014-01-12
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
Plan backyard herb garden @Home +Gardening +Improving +Planning
(A) 2012-01-30 Call Mom @Call @Phone +Family
2013-02-22 Pick up milk @GroceryStore
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todotxt
(C) Add cover sheets @Office +TPSReports
(A) 2012-01-30 Call Mom @Call @Phone +Family
(C) Add cover sheets @Office +TPSReports
Turn off TV @Electricity @Home @Of_Super-Importance @Television Importance:Very!
Research self-publishing services +Novel due:2014-01-01
Plan backyard herb garden @Home +Gardening +Improving +Planning +Relaxing-Work
Research self-publishing services +Novel due:2014-01-01
Turn off TV @Electricity @Home @Television Importance:Very!
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
Turn off TV @Electricity @Home @Television Importance:Very!
x (C) 2014-01-01 Create golang library documentation @Go +go-todotxt due:2014-01-12
(A) 2012-01-30 Call Mom @Call @Phone +Family
x Create golang library @Go +go-todotxt due:2014-01-05
x 2014-01-03 Create golang library @Go +go-todotxt due:2014-01-05
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
xylophone lesson
X 2012-01-01 Make resolutions
x Download Todo.txt mobile app @Phone
x 2014-01-03 Create golang library @Go +go-todotxt due:2014-01-05
x (C) 2014-01-01 Create golang library documentation @Go +go-todotxt due:2014-01-12
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todotxt
2013-02-22 Pick up milk @GroceryStore

View File

@@ -21,11 +21,11 @@ x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todot
# Contexts test cases
(A) 2012-01-30 @Phone Call Mom @Call +Family
(C) Add cover sheets @Office +TPSReports
@Home Turn off TV @Electricity @Television @Electricity Importance:Very!
@Home Turn off TV @Electricity @Television @Electricity @Of_Super-Importance Importance:Very!
Research self-publishing services +Novel +Novel +Novel due:2014-01-01
# Projects test cases
+Gardening Plan backyard herb garden +Planning @Home +Improving
+Gardening Plan backyard herb garden +Planning @Home +Improving +Relaxing-Work
Research self-publishing services +Novel +Novel +Novel due:2014-01-01
@Home Turn off TV @Electricity @Television @Electricity Importance:Very!
@@ -52,3 +52,4 @@ x 2014-01-03 Create golang library @Go +go-todotxt due:2014-01-05
x (C) 2014-01-01 Create golang library documentation @Go +go-todotxt due:2014-01-12
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todotxt
2013-02-22 Pick up milk @GroceryStore

38
testdata/ouput_todo.txt vendored Normal file
View File

@@ -0,0 +1,38 @@
2013-02-22 Pick up milk @GroceryStore
x Download Todo.txt mobile app @Phone
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todotxt
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
x (C) 2014-01-01 Create golang library documentation @Go +go-todotxt due:2014-01-12
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
Plan backyard herb garden @Home +Gardening +Improving +Planning
(A) 2012-01-30 Call Mom @Call @Phone +Family
2013-02-22 Pick up milk @GroceryStore
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todotxt
(C) Add cover sheets @Office +TPSReports
(A) 2012-01-30 Call Mom @Call @Phone +Family
(C) Add cover sheets @Office +TPSReports
Turn off TV @Electricity @Home @Of_Super-Importance @Television Importance:Very!
Research self-publishing services +Novel due:2014-01-01
Plan backyard herb garden @Home +Gardening +Improving +Planning +Relaxing-Work
Research self-publishing services +Novel due:2014-01-01
Turn off TV @Electricity @Home @Television Importance:Very!
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
(B) 2013-12-01 Outline chapter 5 @Computer +Novel Level:5 private:false due:2014-02-17
Turn off TV @Electricity @Home @Television Importance:Very!
x (C) 2014-01-01 Create golang library documentation @Go +go-todotxt due:2014-01-12
(A) 2012-01-30 Call Mom @Call @Phone +Family
x Create golang library @Go +go-todotxt due:2014-01-05
x 2014-01-03 Create golang library @Go +go-todotxt due:2014-01-05
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
xylophone lesson
X 2012-01-01 Make resolutions
x Download Todo.txt mobile app @Phone
x 2014-01-03 Create golang library @Go +go-todotxt due:2014-01-05
x (C) 2014-01-01 Create golang library documentation @Go +go-todotxt due:2014-01-12
x 2014-01-02 (B) 2013-12-30 Create golang library test cases @Go +go-todotxt
x 2014-01-03 2014-01-01 Create some more golang library test cases @Go +go-todotxt
2013-02-22 Pick up milk @GroceryStore