Documentation
¶
Overview ¶
Package flag implements flag-related functionality.
Index ¶
- Constants
- func Add(cmd *cobra.Command, flags ...Flag)
- func Args(ctx context.Context) []string
- func FirstArg(ctx context.Context) string
- func FromContext(ctx context.Context) *pflag.FlagSet
- func GetApp(ctx context.Context) string
- func GetAppConfigFilePath(ctx context.Context) string
- func GetBool(ctx context.Context, name string) bool
- func GetBuildOnly(ctx context.Context) bool
- func GetDetach(ctx context.Context) bool
- func GetInt(ctx context.Context, name string) int
- func GetLocalOnly(ctx context.Context) bool
- func GetOrg(ctx context.Context) string
- func GetRegion(ctx context.Context) string
- func GetRemoteOnly(ctx context.Context) bool
- func GetString(ctx context.Context, name string) string
- func GetStringSlice(ctx context.Context, name string) []string
- func GetYes(ctx context.Context) bool
- func NewContext(ctx context.Context, fs *pflag.FlagSet) context.Context
- type Bool
- type Flag
- type Int
- type String
- type StringSlice
Constants ¶
const ( // AccessTokenName denotes the name of the access token flag. AccessTokenName = "access-token" // VerboseName denotes the name of the verbose flag. VerboseName = "verbose" // JSONOutputName denotes the name of the json output flag. JSONOutputName = "json" // LocalOnlyName denotes the name of the local-only flag. LocalOnlyName = "local-only" // OrgName denotes the name of the org flag. OrgName = "org" // RegionName denotes the name of the region flag. RegionName = "region" // YesName denotes the name of the yes flag. YesName = "yes" // AppName denotes the name of the app flag. AppName = "app" // AppConfigFilePathName denotes the name of the app config file path flag. AppConfigFilePathName = "config" // ImageName denotes the name of the image flag. ImageName = "image" // NowName denotes the name of the now flag. NowName = "now" // NoDeploy denotes the name of the no deploy flag. NoDeployName = "no-deploy" // GenerateName denotes the name of the generate name flag. GenerateNameFlagName = "generate-name" // DetachName denotes the name of the detach flag. DetachName = "detach" )
Variables ¶
This section is empty.
Functions ¶
func FirstArg ¶
FirstArg returns the first arg ctx carries or an empty string in case ctx carries an empty argument set. It panics in case ctx carries no FlagSet.
func FromContext ¶
FromContext returns the FlagSet ctx carries. It panics in case ctx carries no FlagSet.
func GetAppConfigFilePath ¶ added in v0.0.270
GetAppConfigFilePath is shorthand for GetString(ctx, AppConfigFilePathName).
func GetBool ¶
GetBool returns the value of the named boolean flag ctx carries. It panics in case ctx carries no flags or in case the named flag isn't a boolean one.
func GetBuildOnly ¶ added in v0.0.272
func GetInt ¶ added in v0.0.272
GetInt returns the value of the named int flag ctx carries. It panics in case ctx carries no flags or in case the named flag isn't an int one.
func GetLocalOnly ¶ added in v0.0.272
func GetRemoteOnly ¶ added in v0.0.272
func GetString ¶
GetString returns the value of the named string flag ctx carries. It panics in case ctx carries no flags or in case the named flag isn't a string one.
func GetStringSlice ¶ added in v0.0.272
GetString returns the value of the named string flag ctx carries. It panics in case ctx carries no flags or in case the named flag isn't a string one.
Types ¶
type Bool ¶
Bool wraps the set of boolean flags.
func BuildOnly ¶ added in v0.0.272
func BuildOnly() Bool
BuildOnly returns a boolean flag for building without a deployment
func Detach ¶ added in v0.0.272
func Detach() Bool
Detach returns a boolean flag for detaching during deployment
func GenerateName ¶ added in v0.0.272
func GenerateName() Bool
GenerateName returns a boolean flag for generating an application name
func LocalOnly ¶ added in v0.0.272
func LocalOnly() Bool
RemoteOnly returns a boolean flag for deploying remotely
func RemoteOnly ¶ added in v0.0.272
func RemoteOnly() Bool
RemoteOnly returns a boolean flag for deploying remotely
type Flag ¶
type Flag interface {
// contains filtered or unexported methods
}
Flag wraps the set of flags.