From d105df15e972477955d78ab0f9ade69dbcd1785f Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Mon, 24 Apr 2023 15:02:13 -0600 Subject: [PATCH] support -add-tags x,y,z --- cmd/pttodo-cli/cli.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/pttodo-cli/cli.go b/cmd/pttodo-cli/cli.go index 8c4d14b..b740889 100644 --- a/cmd/pttodo-cli/cli.go +++ b/cmd/pttodo-cli/cli.go @@ -37,6 +37,7 @@ type config struct { dry bool add string addSchedule string + addTags string } func main() { @@ -53,10 +54,12 @@ func _main() error { } } if config.add != "" { - if err := add(config.dry, config.targets, pttodo.Todo{ + v := pttodo.Todo{ Todo: config.add, Schedule: pttodo.Schedule(config.addSchedule), - }); err != nil { + Tags: config.addTags, + } + if err := add(config.dry, config.targets, v); err != nil { return err } } @@ -80,12 +83,13 @@ func getConfig() config { flag.StringVar(&config.mergeme, "g", "", "path to yaml file to merge into -f (modifies f)") flag.StringVar(&config.root, "root", DUMP_TODO, "path to pretty print ("+fmt.Sprint([]string{DUMP_ALL, DUMP_TODO, DUMP_SCHEDULED, DUMP_DONE})+")") var tagss string - flag.StringVar(&tagss, "tags", "", "csv of all tags to find, -tag to invert") + flag.StringVar(&tagss, "tags", "", "csv of all tags to find, -x to invert") flag.StringVar(&config.search, "search", "", "fts case insensitive") flag.BoolVar(&config.edit, "e", false, "edit file") flag.BoolVar(&config.dry, "dry", false, "dry run") flag.StringVar(&config.add, "add", "", "todo to add") flag.StringVar(&config.addSchedule, "add-schedule", "", "todo to add schedule") + flag.StringVar(&config.addTags, "add-tags", "", "todo to add csv tags") flag.Parse() config.tags = strings.Split(tagss, ",")