From 0d1eecc168321dbfd56d1fec55c7d6df5eee2c29 Mon Sep 17 00:00:00 2001 From: Quey-Liang Kao Date: Sat, 21 Jan 2017 04:33:46 +0800 Subject: New Feature: Expanding existing todos --- todolist/parser.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'todolist/parser.go') 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) -- cgit v1.3