diff --git a/internal/cli/show_help.go b/internal/cli/show_help.go index daa3eea..72114cc 100644 --- a/internal/cli/show_help.go +++ b/internal/cli/show_help.go @@ -12,7 +12,7 @@ func ShowHelp() { fmt.Println("Options:") for _, option := range constants.Options { - fmt.Printf("%-15s %-5s %s\n", option.Option, option.Alias, option.Description) + fmt.Printf("%-15s %-5s %s\n", option.Name, option.Alias, option.Description) } fmt.Println() diff --git a/internal/config/options.go b/internal/config/options.go index 279fa96..1c9fdd2 100644 --- a/internal/config/options.go +++ b/internal/config/options.go @@ -11,18 +11,23 @@ import ( func ConfigureOptions() { if len(os.Args) != 2 { cli.ShowHelp() + os.Exit(0) } switch os.Args[1] { - case constants.Options[1].Option, constants.Options[1].Alias: + case constants.Options[1].Name, constants.Options[1].Alias: handlers.HandlerOptionCollaborate() - case constants.Options[2].Option, constants.Options[2].Alias: + + case constants.Options[2].Name, constants.Options[2].Alias: handlers.HandlerOptionBuild() - case constants.Options[0].Option, constants.Options[0].Alias: + + case constants.Options[0].Name, constants.Options[0].Alias: cli.ShowVersion() - case constants.Options[3].Option, constants.Options[3].Alias: + + case constants.Options[3].Name, constants.Options[3].Alias: cli.ShowHelp() + default: cli.ShowHelp() } diff --git a/internal/constants/cli.go b/internal/constants/cli.go index 326fc9c..dd66f79 100644 --- a/internal/constants/cli.go +++ b/internal/constants/cli.go @@ -4,22 +4,22 @@ import "github.com/RaulCatalinas/HuskyBC/internal/types" var Options = []types.Option{ { - Option: "--version", + Name: "--version", Alias: "-v", Description: "Output the version number", }, { - Option: "--collaborate", + Name: "--collaborate", Alias: "-co", Description: "Open GitHub repository for collaboration", }, { - Option: "--build", + Name: "--build", Alias: "-b", Description: "Start Husky's configuration", }, { - Option: "--help", + Name: "--help", Alias: "-h", Description: "Display help for command", }, diff --git a/internal/types/cli.go b/internal/types/cli.go index c1e05b7..6734f4b 100644 --- a/internal/types/cli.go +++ b/internal/types/cli.go @@ -1,7 +1,7 @@ package types type Option struct { - Option string + Name string Alias string Description string -} \ No newline at end of file +}