cliutil

package
v0.0.0-...-f6ab670 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 12

Documentation

Overview

Package cliutil contains helper functions for cli and clicommand

Index

Constants

View Source
const (
	HelpFlag                  = "help"
	SsmCliName                = "ssm-cli"
	CLI_PARSE_FAIL_EXITCODE   = 2
	CLI_COMMAND_FAIL_EXITCODE = 255
	CLI_SUCCESS_EXITCODE      = 0
)

Variables

View Source
var CliCommands map[string]CliCommand

CliCommands is the set of support commands

Functions

func FormatFlag

func FormatFlag(flagName string) string

FormatFlag returns a parameter name formatted as a command line flag

func GetAgentIdentity

func GetAgentIdentity() (identity.IAgentIdentity, error)

GetAgentIdentity returns the agent identity and only initializes it once

func GetFlag

func GetFlag(val string) string

GetFlag returns the flag name if val is a flag, or empty if it is not

func IsFlag

func IsFlag(val string) bool

IsFlag returns true if val is a flag

func IsHelp

func IsHelp(subcommands []string, parameters map[string][]string) bool

IsHelp determines if a subcommand or flag is a request for help

func Register

func Register(command CliCommand)

Register

func ValidJson

func ValidJson(s string) bool

ValidJson determines if a string is valid Json

func ValidUrl

func ValidUrl(s string) bool

ValidUrl determines if a string is a valid URL

Types

type CliCommand

type CliCommand interface {
	Execute(subcommands []string, parameters map[string][]string) (error, string)
	Help() string
	Name() string
}

CliCommand defines the interface for all commands the cli can execute

Directories

Path Synopsis
Package mocks represents the mock for interface CliCommand in cliutil package.
Package mocks represents the mock for interface CliCommand in cliutil package.

Jump to

Keyboard shortcuts

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