Skip to content

Commit

Permalink
fix profile check. add message with current hosts file being used.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Marin committed Mar 14, 2020
1 parent e958863 commit f20daa5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"os"
"runtime"

Expand All @@ -21,6 +22,13 @@ You can have multiple profiles, enable/disable exactly what
you need each time with a simple interface.
`,
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
host, _ := cmd.Flags().GetString("host-file")

fmt.Printf("Using hosts file: %s\n", host)

return nil
},
}

func Execute() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/host/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func ValidProfile(p string) error {

// NotEmptyProfile controls the profile name.
func NotEmptyProfile(p string) error {
if p != "" {
if p == "" {
return errors.New("profile can't be empty")
}

Expand Down

0 comments on commit f20daa5

Please sign in to comment.