Documentation ¶
Overview ¶
Package cli contains all definitions pertaining to the user-visible commands of the epinio client. It provides the viper/cobra setup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdCompletion = &cobra.Command{ Use: "completion [bash|zsh|fish|powershell]", Short: "Generate completion script for a shell", Long: `To load completions: Bash: $ source <(epinio completion bash) # To load completions for each session, execute once: Linux: $ epinio completion bash > /etc/bash_completion.d/epinio MacOS: $ epinio completion bash > /usr/local/etc/bash_completion.d/epinio ATTENTION: The generated script requires the bash-completion package. See https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion for information on how to install and activate it. Zsh: # If shell completion is not already enabled in your environment you will need # to enable it. You can execute the following once: $ echo "autoload -U compinit; compinit" >> ~/.zshrc # To load completions for each session, execute once: $ epinio completion zsh > "${fpath[1]}/_epinio" # You will need to start a new shell for this setup to take effect. Fish: $ epinio completion fish | source # To load completions for each session, execute once: $ epinio completion fish > ~/.config/fish/completions/epinio.fish Powershell: PS> epinio completion powershell | Out-String | Invoke-Expression # To load completions for every new session, run: PS> epinio completion powershell > epinio.ps1 # and source this file from your powershell profile. `, DisableFlagsInUseLine: true, ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), RunE: func(cmd *cobra.Command, args []string) error { switch args[0] { case "bash": return cmd.Root().GenBashCompletion(os.Stdout) case "zsh": return cmd.Root().GenZshCompletion(os.Stdout) case "fish": return cmd.Root().GenFishCompletion(os.Stdout, true) case "powershell": return cmd.Root().GenPowerShellCompletion(os.Stdout) } return errors.New("Internal error: Invalid shell") }, }
CmdCompletion represents the completion command
View Source
var CmdDebug = &cobra.Command{ Hidden: true, Use: "debug", Short: "Dev Tools", Long: `Developer Tools. Hidden From Regular User.`, SilenceErrors: true, SilenceUsage: true, Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { if err := cmd.Usage(); err != nil { return err } return fmt.Errorf(`Unknown method "%s"`, args[0]) }, }
CmdDebug implements the command: epinio debug
View Source
var CmdDebugTTY = &cobra.Command{ Use: "tty", Short: "Running In a Terminal?", Long: `Running In a Terminal?`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { cmd.SilenceUsage = true if isatty.IsTerminal(os.Stdout.Fd()) { fmt.Println("Is Terminal") } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) { fmt.Println("Is Cygwin/MSYS2 Terminal") } else { fmt.Println("Is Not Terminal") } return nil }, }
CmdDebug implements the command: epinio debug tty
View Source
var CmdServer = &cobra.Command{ Use: "server", Short: "Starts the Epinio server.", Long: "This command starts the Epinio server. `epinio install` ensures the server is running inside your cluster. Normally you don't need to run this command manually.", RunE: func(cmd *cobra.Command, args []string) error { cmd.SilenceUsage = true logger := tracelog.NewLogger().WithName("EpinioServer") cpuRequest := viper.GetString("staging-resource-cpu") if cpuRequest != "" { _, err := resource.ParseQuantity(cpuRequest) if err != nil { return errors.Wrap(err, "bad cpu request for staging job") } } memoryRequest := viper.GetString("staging-resource-memory") if memoryRequest != "" { _, err := resource.ParseQuantity(memoryRequest) if err != nil { return errors.Wrap(err, "bad memory request for staging job") } } diskRequest := viper.GetString("staging-resource-disk") if diskRequest != "" { _, err := resource.ParseQuantity(diskRequest) if err != nil { return errors.Wrap(err, "bad disk size request for staging job") } } handler, err := server.NewHandler(logger) if err != nil { return errors.Wrap(err, "error creating handler") } port := viper.GetInt("port") listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) if err != nil { return errors.Wrap(err, "error creating listener") } ui := termui.NewUI() ui.Normal().Msg("Epinio version: " + version.Version) listeningPort := strconv.Itoa(listener.Addr().(*net.TCPAddr).Port) ui.Normal().Msg("listening on localhost on port " + listeningPort) trackingDisabled := viper.GetBool("disable-tracking") upgradeResponderAddress := viper.GetString("upgrade-responder-address") logger.Info("Checking upgrade-responder tracking", "disabled", trackingDisabled, "upgradeResponderAddress", upgradeResponderAddress) if !trackingDisabled { checker, err := upgraderesponder.NewChecker(context.Background(), logger, upgradeResponderAddress) if err != nil { return errors.Wrap(err, "error creating listener") } checker.Start() defer checker.Stop() } return startServerGracefully(listener, handler) }, }
CmdServer implements the command: epinio server
Functions ¶
func Execute ¶
func Execute()
Execute executes the root command. This is called by main.main(). It only needs to happen once to the rootCmd.
func NewRootCmd ¶ added in v1.8.1
NewRootCmd returns the rootCmd, that is the main `epinio` cli.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
cmdfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Package logprinter is used to print container log lines in color
|
Package logprinter is used to print container log lines in color |
Package server provides the Epinio http server
|
Package server provides the Epinio http server |
requestctx
Package requestctx provides access to special fields in the http request's context
|
Package requestctx provides access to special fields in the http request's context |
Package usercmd provides Epinio CLI commands for users
|
Package usercmd provides Epinio CLI commands for users |
usercmdfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Click to show internal directories.
Click to hide internal directories.