Skip to content

Commit

Permalink
clarify output messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktaylorsbg committed Jul 9, 2022
1 parent d91fd20 commit 35d93d4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var loadCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {

if len(args) == 0 {
fmt.Fprintf(cmd.OutOrStdout(), "No paths found.\n")
fmt.Fprintf(cmd.OutOrStdout(), "No args provided. Please provide paths to the configuration files to load e.g > conan load /conf/conf.json /otherconf/*.json\n")
return
}

Expand All @@ -132,6 +132,11 @@ var loadCmd = &cobra.Command{
}
}

if len(files) == 0 {
fmt.Fprintf(cmd.OutOrStdout(), "No configuration files found for provided paths.\n")
return
}

rhttp := retryablehttp.NewClient()
rhttp.RetryMax = 3
rhttp.RetryWaitMin = time.Duration(5 * time.Second)
Expand All @@ -153,7 +158,7 @@ var loadCmd = &cobra.Command{
}

if allValid {
fmt.Fprintf(cmd.OutOrStdout(), "All connectors are valid loading configs.\n")
fmt.Fprintf(cmd.OutOrStdout(), "All connectors are valid. Loading configs.\n")
for i, file := range files {
files[i].LoadResp = LoadConfig(rhttp, host, port, file)
}
Expand All @@ -166,7 +171,7 @@ var loadCmd = &cobra.Command{
os.Exit(1)
}
if !allValid {
fmt.Fprintf(cmd.OutOrStdout(), "Validation errors found, skipped loading configs and exiting.\n")
fmt.Fprintf(cmd.OutOrStdout(), "Validation errors found, skipped loading configs.\n")
os.Exit(1)
}

Expand Down

0 comments on commit 35d93d4

Please sign in to comment.