utils

package
v0.0.0-...-ee5af42 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package utils contains all the utility functions.

Package utils contains all the utility functions.

Index

Constants

View Source
const (
	HelpFlag   = "help"
	SsmCliName = "ssmcli"
	FlagPrefix = "--"
)

Variables

View Source
var SsmCliCommands map[string]SsmCliCommand

CliCommands is the set of support commands

Functions

func DisplayCommandUsage

func DisplayCommandUsage(out io.Writer)

DisplayCommandUsage prints cli usage info to console

func DisplayHelp

func DisplayHelp(out io.Writer)

DisplayHelp shows help for the ssmcli

func DisplaySupportedCommands

func DisplaySupportedCommands(out io.Writer)

DisplaySupportedCommands prints a list of supported cli commands to the console

func FormatFlag

func FormatFlag(flagName string) string

FormatFlag returns a parameter name formatted as a command line flag

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(subcommand string, parameters map[string][]string) bool

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

func Register

func Register(command SsmCliCommand)

Register

Types

type SsmCliCommand

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

CliCommand defines the interface for all commands the cli can execute

Jump to

Keyboard shortcuts

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