Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 8a2c8ae

Browse files
author
Mathias Lindholm
authored
Improve no .speechly.yaml error message (#60)
1 parent 53529ce commit 8a2c8ae

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/clients/config.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ func getSpeechlyConfig() (*Config, error) {
7171

7272
if err := viper.ReadInConfig(); err != nil {
7373
if len(os.Args) < 2 || (os.Args[1] != "config" && os.Args[1] != "projects") {
74-
log.Print("Please add a project first:\n\n")
75-
log.Print(" 1. Create a new API token in Speechly Dashboard (https://api.speechly.com/dashboard)\n")
76-
log.Printf(" 2. Copy the token and run: %s projects add --apikey <api_token>\n\n", os.Args[0])
74+
log.Print("Please add a project:\n\n")
75+
log.Print(" 1. Log in to Speechly Dashboard (https://api.speechly.com/dashboard)\n")
76+
log.Printf(" 2. Go to %s and create a new token\n", infoString("Project Settings → API tokens"))
77+
log.Printf(" 2. Copy the token and run: %s\n\n", infoString(fmt.Sprintf("%s projects add <api_token>", os.Args[0])))
7778
log.Print("Learn more: https://docs.speechly.com/dev-tools/command-line-tool")
7879
os.Exit(1)
7980
}
@@ -92,3 +93,8 @@ func getSpeechlyConfig() (*Config, error) {
9293
}
9394
return &conf, nil
9495
}
96+
97+
func infoString(str string) string {
98+
color := "\033[1;36m%s\033[0m"
99+
return fmt.Sprintf(color, str)
100+
}

0 commit comments

Comments
 (0)