Pre-existing CLI improvements ahead of the tarball-publish refactor: - New top-level `ninja scope` command (create, list, set-default). - `init` accepts no --scope: prompts from ListMyScopes or uses creds default. - Plugin name prompted if not provided. - `plugin bump <major|minor|patch>` writes the bumped version into plugin.mod. - `plugin version` prints the current plugin.mod version. - `login` prints a URL with ?user_code= so the link is one click. - creds: HostCreds gains optional default_scope. - plugin/version: ParseBaseSemver + BumpVersion helpers, with tests.
20 lines
595 B
Go
20 lines
595 B
Go
package cmd
|
|
|
|
import "github.com/spf13/cobra"
|
|
|
|
func NewRoot() *cobra.Command {
|
|
root := &cobra.Command{
|
|
Use: "ninja",
|
|
Short: "BlockNinja developer CLI",
|
|
Long: "ninja is the developer-facing CLI for BlockNinja. First subcommand group: plugin.",
|
|
}
|
|
root.PersistentFlags().String("host", "", "Orchestrator base URL (default: from credentials or https://my.blockninjacms.com)")
|
|
root.AddCommand(newVersionCmd())
|
|
root.AddCommand(newLoginCmd())
|
|
root.AddCommand(newLogoutCmd())
|
|
root.AddCommand(newWhoamiCmd())
|
|
root.AddCommand(newPluginCmd())
|
|
root.AddCommand(newScopeCmd())
|
|
return root
|
|
}
|