From f7fb0d75768c3b091924409ccf89e03c1c35672d Mon Sep 17 00:00:00 2001 From: kaderno Date: Mon, 2 Mar 2020 20:45:47 +1100 Subject: [PATCH] Added check for template file Signed-off-by: kadern0 --- cmd/create_github.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/create_github.go b/cmd/create_github.go index 44930d0..4c9328b 100644 --- a/cmd/create_github.go +++ b/cmd/create_github.go @@ -7,6 +7,7 @@ import ( "net/url" "os" "os/exec" + "path" "runtime" "strings" "time" @@ -64,6 +65,10 @@ func createGitHubAppE(command *cobra.Command, _ []string) error { "GitHubEvent": fmt.Sprintf("%s://system.%s/github-event", scheme, rootDomain), } + if _, err := os.Stat(path.Join("./pkg/github", "index.html")); err != nil { + return fmt.Errorf("Cannot find the template file. You need to run this command from the root directory of the repository.\n ") + } + fmt.Printf("Name: %s\tRoot domain: %s\tScheme: %v\n", name, rootDomain, scheme) launchBrowser := true