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 get-token and try-login commands to test login and test token #100

Merged
merged 5 commits into from
Feb 20, 2021

Conversation

morganelle
Copy link
Contributor

@morganelle morganelle commented Feb 19, 2021

Description

rename get-token and try-login commands to test login and test token

References

https://auth0team.atlassian.net/browse/CLI-4
https://auth0team.atlassian.net/browse/CLI-5

Testing

Tested manually

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@paddycarey
Copy link
Contributor

@morganelle might this make more sense as 2 subcommands nested under test? I think cobra would then let you do auth0 test --help to see the subcommands.

Check out https://github.com/auth0/auth0-cli/blob/main/internal/cli/clients.go for an example of this pattern.

@morganelle
Copy link
Contributor Author

@morganelle might this make more sense as 2 subcommands nested under test? I think cobra would then let you do auth0 test --help to see the subcommands.

Check out https://github.com/auth0/auth0-cli/blob/main/internal/cli/clients.go for an example of this pattern.

Thanks @paddycarey! Just had a talk with @cyx and he suggested the same - I'll update.

@morganelle
Copy link
Contributor Author

@paddycarey @cyx updated. I hit an issue where I was getting a nil cli because the command was named login. I added another condition to skip it if it wasn't a top level command.

@@ -29,7 +29,7 @@ func Execute() {
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// If the user is trying to login, no need to go
// through setup.
if cmd.Use == "login" {
if cmd.Use == "login" && cmd.Parent().Use == "auth0" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh good catch! 👍

Copy link
Contributor

@cyx cyx left a comment

Choose a reason for hiding this comment

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

Looks good thanks for working through it! 👍

@cyx cyx merged commit d4cfb4e into main Feb 20, 2021
@cyx cyx deleted the rename-test-cmds branch February 20, 2021 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants