cliutil

package
v0.0.0-...-7638cb1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cliutil contains helper functions for cli and clicommand

Index

Constants

View Source
const (
	HelpFlag   = "help"
	SsmCliName = "ssm-cli"
)

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 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

Jump to

Keyboard shortcuts

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