From 61fceac7d565c385a43554912d24a299440a84d1 Mon Sep 17 00:00:00 2001 From: Morgan Pittkin Date: Wed, 25 Oct 2023 16:07:45 -0400 Subject: [PATCH] Fix bug from old code left in that took first argument as root path --- main.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 10ed3b3..7068d12 100644 --- a/main.go +++ b/main.go @@ -47,7 +47,7 @@ func main() { cfg.RepoTitle = os.Getenv("GOTODO_REPO_TITLE") pathFlag := flag.String("root-path", "", "the root path from which directories will be traversed looking for files to parse") - outputFlag := flag.String("output-type", "", "the output type (console, json, or slack-webhook") + outputFlag := flag.String("output-type", "", "the output type ('console' or 'slack-webhook'") webhookFlag := flag.String("slack-webhook-url", "", "when output type is set to 'slack-webhook' defines the url to send the POST request") titleFlag := flag.String("repo-title", "", "when output type is set to slack-webhook, this is included in the report to indicate to the reader the source of the todos") @@ -65,17 +65,9 @@ func main() { cfg.SlackWebhookURL = *titleFlag } - rootPath := "." - if len(os.Args) > 1 { - rootPath = os.Args[1] - if err := os.Chdir(rootPath); err != nil { - log.Fatalf("Unable to change directory to %s\n", rootPath) - } - } - - absPath, err := filepath.Abs(rootPath) + absPath, err := filepath.Abs(cfg.RootPath) if err != nil { - log.Fatalf("Unable to convert path '%s' to absolute path: %s", rootPath, err) + log.Fatalf("Unable to convert path '%s' to absolute path: %s", cfg.RootPath, err) } fmt.Println("Starting at " + absPath)