Skip to content

Commit

Permalink
Adds chef-analyze help / Usage()
Browse files Browse the repository at this point in the history
The usage here is to enable our pipeline to check if the chef-analyze
command was built and install and runs. (Minimal check)

chef/chef-workstation#553

Signed-off-by: Salim Afiune <afiune@chef.io>
  • Loading branch information
Salim Afiune committed Oct 1, 2019
1 parent fc077c2 commit 09bd26e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ func main() {
clientKey string
chefServerUrl string
)

flag.StringVar(&clientName, "user", "", "Chef Infra Server API client username.")
flag.StringVar(&clientKey, "key", "", "Chef Infra Server API client key.")
flag.StringVar(&chefServerUrl, "chef_server_url", "", "Chef Infra Server URL.")
flag.Parse()

if len(os.Args) > 1 && os.Args[1] == "help" {
flag.Usage()
os.Exit(0)
}

if clientName == "" || clientKey == "" || chefServerUrl == "" {
fmt.Println("One or more parameters missing.\n\nRequired:\n\t-user USER\n\t-key KEY\n\t-chef_server_url URL")
fmt.Println("One or more required parameters missing:")
flag.PrintDefaults()
os.Exit(1)
}

Expand Down

0 comments on commit 09bd26e

Please sign in to comment.