aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/parser.go
diff options
context:
space:
mode:
authorQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-01-21 04:33:46 +0800
committerQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-01-21 05:08:37 +0800
commit0d1eecc168321dbfd56d1fec55c7d6df5eee2c29 (patch)
tree98bf878ca64afd082788ad98370fedf34bfa7645 /todolist/parser.go
parent994709884e05d803e34578d74893e5e1c20da417 (diff)
New Feature: Expanding existing todos
Diffstat (limited to 'todolist/parser.go')
-rw-r--r--todolist/parser.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/todolist/parser.go b/todolist/parser.go
index 62d864d..3ad3aae 100644
--- a/todolist/parser.go
+++ b/todolist/parser.go
@@ -39,6 +39,17 @@ func (p *Parser) Subject(input string) string {
}
}
+func (p *Parser) ExpandProject(input string) string {
+ r, _ := regexp.Compile(`(ex|expand) +\d+ +\+\w+[^:]`)
+ newProject := r.FindString(input)
+ if len(newProject) == 0 {
+ return ""
+ }
+
+ project := strings.Split(newProject, " ")
+ return project[len(project)-1]
+}
+
func (p *Parser) Projects(input string) []string {
r, _ := regexp.Compile(`\+\w+`)
return p.matchWords(input, r)