Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename quickstart command [CLI-16] #102

Merged
merged 4 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/cli/quickstart.go → internal/cli/quickstarts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ import (
"gopkg.in/auth0.v5/management"
)

func quickstartCmd(cli *cli) *cobra.Command {
func quickstartsCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "quickstart",
Use: "quickstarts",
Short: "Quickstart support for getting bootstrapped",
Aliases: []string{"qs"},
}

cmd.SetUsageTemplate(resourceUsageTemplate())
cmd.AddCommand(quickstartDownloadCmd(cli))
cmd.AddCommand(downloadQuickstart(cli))

return cmd
}

func quickstartDownloadCmd(cli *cli) *cobra.Command {
func downloadQuickstart(cli *cli) *cobra.Command {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(NAB) all these commands and subcommands init functions live on the same package (cli), at some point it can be painful to find unique names, that's why I think keeping the "full subcommand path" as the func name is a good idea (quickstartsDownload() in this case). Alternatively we can move each family of commands to its own package 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to eventually have each family of commands on its own package, yes.

var flags struct {
ClientID string
Type string
Expand All @@ -41,7 +41,7 @@ func quickstartDownloadCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "download",
Short: "Download a specific type and tech stack for quick starts",
Long: `auth0 quickstart download --type <type> --client-id <client-id> --stack <stack>`,
Long: `auth0 quickstarts download --type <type> --client-id <client-id> --stack <stack>`,
RunE: func(cmd *cobra.Command, args []string) error {
client, err := cli.api.Client.Read(flags.ClientID)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func Execute() {
// order of the comamnds here matters
// so add new commands in a place that reflect its relevance or relation with other commands:
rootCmd.AddCommand(loginCmd(cli))
rootCmd.AddCommand(quickstartCmd(cli))
rootCmd.AddCommand(appsCmd(cli))
rootCmd.AddCommand(quickstartsCmd(cli))
rootCmd.AddCommand(apisCmd(cli))
rootCmd.AddCommand(testCmd(cli))
rootCmd.AddCommand(logsCmd(cli))
Expand Down