Skip to content

Commit

Permalink
Cli 92 (#222)
Browse files Browse the repository at this point in the history
* [CLI-92] updated apps command with examples

* [CLI-92] updated rules command with examples

* [CLI-92] added examples to apis command

* [CLI-92] clean up whitespaces
  • Loading branch information
bright-poku authored Apr 2, 2021
1 parent 2c2b578 commit 00fd384
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 58 deletions.
41 changes: 21 additions & 20 deletions internal/cli/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ func scopesCmd(cli *cli) *cobra.Command {
func listApisCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "List your APIs",
Long: `auth0 apis list
Lists your existing APIs. To create one try:
auth0 apis create
`,
Example: `auth0 apis list
auth0 apis ls`,
RunE: func(cmd *cobra.Command, args []string) error {
var list *management.ResourceServerList

Expand Down Expand Up @@ -106,10 +108,9 @@ func showApiCmd(cli *cli) *cobra.Command {
Use: "show",
Args: cobra.MaximumNArgs(1),
Short: "Show an API",
Long: `Show an API:
auth0 apis show <id>
`,
Long: `Show an API:`,
Example: `auth0 apis show
auth0 apis show <id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -151,9 +152,10 @@ func createApiCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "Create a new API",
Long: `Create a new API:
auth0 apis create --name myapi --identifier http://my-api
Long: `Create a new API`,
Example: `auth0 apis create
auth0 apis create --name myapi
auth0 apis create -n myapi --identifier http://my-api
`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
Expand Down Expand Up @@ -209,10 +211,10 @@ func updateApiCmd(cli *cli) *cobra.Command {
Use: "update",
Args: cobra.MaximumNArgs(1),
Short: "Update an API",
Long: `Update an API:
auth0 apis update <id> --name myapi
`,
Long: `Update an API:`,
Example: `auth0 apis update
auth0 apis update <id>
auth0 apis update <id> --name myapi`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -284,10 +286,9 @@ func deleteApiCmd(cli *cli) *cobra.Command {
Use: "delete",
Args: cobra.MaximumNArgs(1),
Short: "Delete an API",
Long: `Delete an API:
auth0 apis delete <id>
`,
Long: `Delete an API:`,
Example: `auth0 apis delete
auth0 apis delete <id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -327,12 +328,12 @@ func listScopesCmd(cli *cli) *cobra.Command {

cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1),
Short: "List the scopes of an API",
Long: `List the scopes of an API:
auth0 apis scopes list <id>
`,
Long: `List the scopes of an API`,
Example: `auth0 apis scopes list
auth0 apis scopes ls <id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down
46 changes: 22 additions & 24 deletions internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ func useAppCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "use",
Short: "Choose a default application",
Long: `auth0 apps use <client-id>
Specify your preferred application for interaction with the Auth0 CLI
`,
Long: `Specify your preferred application for interaction with the Auth0 CLI`,
Example: `auth0 apps use <client-id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -181,12 +180,12 @@ Specify your preferred application for interaction with the Auth0 CLI
func listAppsCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "List your applications",
Long: `auth0 apps list
Lists your existing applications. To create one try:
auth0 apps create
`,
Long: `Lists your existing applications. To create one try:
auth0 apps create`,
Example: `auth0 apps list
auth0 apps ls`,
RunE: func(cmd *cobra.Command, args []string) error {
var list *management.ClientList

Expand Down Expand Up @@ -215,10 +214,9 @@ func showAppCmd(cli *cli) *cobra.Command {
Use: "show",
Args: cobra.MaximumNArgs(1),
Short: "Show an application",
Long: `Show an application:
auth0 apps show <id>
`,
Long: `Show an application:`,
Example: `auth0 apps show
auth0 apps show <id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -260,10 +258,9 @@ func deleteAppCmd(cli *cli) *cobra.Command {
Use: "delete",
Args: cobra.MaximumNArgs(1),
Short: "Delete an application",
Long: `Delete an application:
auth0 apps delete <id>
`,
Long: `Delete an application:`,
Example: `auth0 apps delete
auth0 apps delete <id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -310,10 +307,11 @@ func createAppCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "Create a new application",
Long: `Create a new application:
auth0 apps create --name myapp --type [native|spa|regular|m2m]
`,
Long: `Create a new application:`,
Example: `auth0 apps create
auth0 apps create --name myapp
auth0 apps create -n myapp --type [native|spa|regular|m2m]
auth0 apps create -n myapp -t [native|spa|regular|m2m] -- description <description>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -453,10 +451,10 @@ func updateAppCmd(cli *cli) *cobra.Command {
Use: "update",
Args: cobra.MaximumNArgs(1),
Short: "Update an application",
Long: `Update an application:
auth0 apps update <id> --name myapp --type [native|spa|regular|m2m]
`,
Long: `Update an application`,
Example: `auth0 apps update <id>
auth0 apps update <id> --name myapp
auth0 apps update <id> -n myapp --type [native|spa|regular|m2m]`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down
31 changes: 17 additions & 14 deletions internal/cli/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ func rulesCmd(cli *cli) *cobra.Command {
func listRulesCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "List your rules",
Long: `List the rules in your current tenant.`,
Example: `auth0 rules list
auth0 rules ls`,
RunE: func(cmd *cobra.Command, args []string) error {
var rules []*management.Rule
err := ansi.Waiting(func() error {
Expand Down Expand Up @@ -103,10 +106,11 @@ func createRuleCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "Create a new rule",
Long: `Create a new rule:
auth0 rules create --name "My Rule" --template [empty-rule]"
`,
Long: `Create a new rule:`,
Example: `auth0 rules create
auth0 rules create --name "My Rule"
auth0 rules create -n "My Rule" --template "Empty rule"
auth0 rules create -n "My Rule" -t "Empty rule" --enabled=false`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -165,10 +169,9 @@ func showRuleCmd(cli *cli) *cobra.Command {
Use: "show",
Args: cobra.MaximumNArgs(1),
Short: "Show a rule",
Long: `Show a rule:
auth0 rules show <id>
`,
Long: `Show a rule:`,
Example: `auth0 rules show
auth0 rules show <id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down Expand Up @@ -210,8 +213,8 @@ func deleteRuleCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "delete",
Short: "Delete a rule",
Long: `Delete a rule:
Long: `Delete a rule`,
Example: `auth0 rules delete
auth0 rules delete <rule-id>`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
Expand Down Expand Up @@ -251,10 +254,10 @@ func updateRuleCmd(cli *cli) *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Short: "Update a rule",
Long: `Update a rule:
auth0 rules update <rule-id> --name "My Updated Rule" --enabled=false
`,
Long: `Update a rule`,
Example: `auth0 rules update <rule-id>
auth0 rules update <rule-id> --name "My Updated Rule"
auth0 rules update <rule-id> -n "My Updated Rule" --enabled=false`,
PreRun: func(cmd *cobra.Command, args []string) {
prepareInteractivity(cmd)
},
Expand Down

0 comments on commit 00fd384

Please sign in to comment.