cmd

package
v0.2.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

README

Command Line Interface (CLI) for DataRobot

Modules in this folder implement various command line commands and subcommands for interacting with DataRobot services.

There should be a one-to-one mapping between commands/subcommands and modules in this folder. Each module typically contains the logic for parsing command line arguments, handling user input, and invoking the appropriate functions from internal or tui packages to perform the desired operations.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomHelpTemplate = getHelpHeader() + `
{{with .Long}}{{. | trimTrailingWhitespaces}}

{{end}}{{if or .Runnable .HasSubCommands}}` + getSectionHeader("Usage:") + `{{if .Runnable}}
  {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
  {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}

` + getSectionHeader("Aliases:") + `
  {{.NameAndAliases}}{{end}}{{if .HasExample}}

` + getSectionHeader("Examples:") + `
{{.Example}}{{end}}{{if .HasAvailableSubCommands}}{{$cmds := .Commands}}{{if eq (len .Groups) 0}}

` + getSectionHeader("Available Commands:") + `{{range $cmds}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
  ` + getCommandColor() + `{{rpad .Name .NamePadding }}` + resetCommandStyle() + ` {{.Short}}{{end}}{{end}}{{else}}{{range $group := .Groups}}{{$hasCommands := false}}{{range $cmds}}{{if (and (eq .GroupID $group.ID) (or .IsAvailableCommand (eq .Name "help")))}}{{$hasCommands = true}}{{end}}{{end}}{{if $hasCommands}}

` + getSectionHeader("{{.Title}}") + `{{range $cmds}}{{if (and (eq .GroupID $group.ID) (or .IsAvailableCommand (eq .Name "help")))}}
  ` + getCommandColor() + `{{rpad .Name .NamePadding }}` + resetCommandStyle() + ` {{.Short}}{{end}}{{end}}{{end}}{{end}}{{if not .AllChildCommandsHaveGroup}}

` + getSectionHeader("Additional Commands:") + `{{range $cmds}}{{if (and (eq .GroupID "") (or .IsAvailableCommand (eq .Name "help")))}}
  ` + getCommandColor() + `{{rpad .Name .NamePadding }}` + resetCommandStyle() + ` {{.Short}}{{end}}{{end}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}

` + getSectionHeader("Flags:") + `
{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}

` + getSectionHeader("Global Flags:") + `
{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}

` + getSectionHeader("Additional help topics:") + `{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
  {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}

Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}{{end}}
`
View Source
var RootCmd = &cobra.Command{
	Use:     internalVersion.CliName,
	Version: internalVersion.Version,
	Short:   "Build AI Applications Faster",
	Long: `
The DataRobot CLI helps you quickly set up, configure, and deploy AI applications
using pre-built templates. Get from idea to production in minutes, not hours.

✨ ` + tui.BaseTextStyle.Render("What you can do:") + `
  • Choose from ready-made AI application templates
  • Set up your development environment quickly
  • Deploy to DataRobot with a single command
  • Manage environment variables and configurations

🎯 ` + tui.BaseTextStyle.Render("Quick Start:") + `
  dr start             # Create your first AI app (start here!)
  dr --help            # Show all available commands

💡 ` + tui.BaseTextStyle.Render("New to AI development?") + ` Perfect! Run 'dr start' and we'll guide you through everything.`,

	PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {

		useDebug, _ := cmd.Flags().GetBool("debug")
		useVerbose, _ := cmd.Flags().GetBool("verbose")

		if useDebug {
			setLogLevel(log.DebugLevel)
		} else if useVerbose {
			setLogLevel(log.InfoLevel)
		}
		return initializeConfig(cmd)
	},
	PostRun: func(_ *cobra.Command, _ []string) {

		setLogLevelFromConfig()
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func ExecuteContext added in v0.1.5

func ExecuteContext(ctx context.Context) error

ExecuteContext executes the root command with the given context. It adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL