cli

package
v2.2.13 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package cli provides CLI access to the Platform.CC API.

Index

Constants

This section is empty.

Variables

View Source
var AutoCompleteListCmd = &cobra.Command{
	Hidden: true,
	Use:    "_ac",
	Run: func(cmd *cobra.Command, args []string) {
		output.Enable = false
		output.Logging = false

		if len(args) > 0 {
			argStr := ""
			for _, arg := range strings.Split(args[0], ":") {
				argStr += strings.TrimSpace(arg) + ":"
			}
			argStr = strings.TrimSuffix(argStr, ":")
			args = strings.Split(argStr, " ")
		}
		if len(args) <= 1 {

			argStr := ""
			if len(args) > 0 {
				argStr = args[0]
			}
			out := filterListCommandAliases(RootCmd, argStr)
			output.WriteStdout(strings.Join(out, " "))
		} else if len(args) > 1 {

			findCmd, _, err := RootCmd.Find(strings.Split(args[0], ":"))
			if err != nil {
				return
			}

			if findCmd.Parent() == containerCmd {
				handleServiceFlag(containerCmd, args)
				return
			} else if findCmd.Parent() == databaseCmd {
				handleServiceFlag(databaseCmd, args)
				handleDatabaseFlag(databaseCmd, args)
				return
			}
		}
	},
}

AutoCompleteListCmd list every possible command for Bash auto-complete.

View Source
var (
	// ErrDefinitionNotFound is an error returns when a service definition is not found.
	ErrDefinitionNotFound = errors.New("definition not found")
)
View Source
var ListCmd = &cobra.Command{
	Use:     "list",
	Version: "",
	Short:   "Show this list.",
	Run: func(cmd *cobra.Command, args []string) {
		commandIntro(RootCmd.Version)
		output.WriteStdout("\nAvailable Commands:\n")
		displayCommandList(RootCmd)
	},
}

ListCmd lists all available commands.

View Source
var RootCmd = &cobra.Command{
	Use:     "platform_cc [-v verbose]",
	Version: "",
	Run: func(cmd *cobra.Command, args []string) {
		commandIntro(cmd.Version)
		output.WriteStdout("\nAvailable Commands:\n")
		displayCommandList(cmd)
	},
}

RootCmd is the top level command.

Functions

func Execute

func Execute() error

Execute - run root command

Types

This section is empty.

Jump to

Keyboard shortcuts

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