MCPcopy Create free account
hub / github.com/auth0/auth0-cli / buildRootCmd

Function buildRootCmd

internal/cli/root.go:103–131  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

101}
102
103func buildRootCmd(cli *cli) *cobra.Command {
104 rootCmd := &cobra.Command{
105 Use: "auth0",
106 SilenceUsage: true,
107 SilenceErrors: true,
108 Short: rootShort,
109 Long: rootShort + "\n" + getLogin(cli),
110 Version: buildinfo.GetVersionWithCommit(),
111 PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
112 cli.executedCommandPath = cmd.CommandPath()
113
114 ansi.Initialize(cli.noColor)
115 prepareInteractivity(cmd)
116 cli.configureRenderer()
117
118 if !commandRequiresAuthentication(cmd.CommandPath()) {
119 return nil
120 }
121
122 if err := cli.setupWithAuthentication(cmd.Context()); err != nil {
123 return err
124 }
125
126 return nil
127 },
128 }
129
130 return rootCmd
131}
132
133func commandRequiresAuthentication(invokedCommandName string) bool {
134 commandsWithNoAuthRequired := []string{

Callers 1

ExecuteFunction · 0.85

Calls 7

GetVersionWithCommitFunction · 0.92
InitializeFunction · 0.92
getLoginFunction · 0.85
prepareInteractivityFunction · 0.85
configureRendererMethod · 0.80

Tested by

no test coverage detected