From 8ac7a45465caaf456ed3e25f4b0a38e13be77d20 Mon Sep 17 00:00:00 2001 From: BrunoTeixeira1996 Date: Wed, 1 Dec 2021 22:10:31 +0000 Subject: [PATCH] Fixed FIXME#9 implementing a map for options instead of printing all --- main.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 45ca71e..2e9ab85 100644 --- a/main.go +++ b/main.go @@ -173,11 +173,23 @@ func purgeSubcommand(project Project, creds IssueAPI, repo string, alwaysYes boo } func usage() { - // FIXME(#9): implement a map for options instead of println'ing them all there - fmt.Printf("snitch [opt]\n" + - "\tlist [--unreported] [--reported] [--y] [--remote]: lists all todos of a dir recursively\n" + - "\treport [--prepend-body ] [--y] [--remote]: reports all todos of a dir recursively \n\t\tas GitHub issues\n" + - "\tpurge [--remote]: removes all of the reported TODOs that refer to closed issues\n") + help := map[string]string{ + "list": "[--unreported] [--reported] [--y] [--remote]: lists all todos of a dir recursively", + "report": "[--prepend-body ] [--y] [--remote]: reports all todos of a dir recursively as Github issues", + "purge": "[--remote]: removes all of the reported TODOs that refer to closed issues", + } + + keys := make([]string, 0) + + for k, _ := range help { + keys = append(keys, k) + } + + // sorting the map into a slice + sort.Strings(keys) + for _, k := range keys { + fmt.Println(k, help[k]) + } } func locateDotGit(dir string) (string, error) {