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 GetDuration(ctx context.Context, name string) time.Duration
- 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 IsSpecified(ctx context.Context, name string) bool
- func NewContext(ctx context.Context, fs *pflag.FlagSet) context.Context
- type Bool
- type Duration
- type Flag
- type Int
- type Set
- 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 ¶
GetAppConfigFilePath is shorthand for GetString(ctx, AppConfigFilePathName).
func GetBuildOnly ¶
func GetDuration ¶ added in v0.0.500
GetDuration returns the value of the named duration flag ctx carries.
func GetInt ¶
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 ¶
func GetRemoteOnly ¶
func GetStringSlice ¶
GetString returns the value of the named string flag ctx carries.
func IsSpecified ¶ added in v0.0.475
IsSpecified returns whether a flag has been specified at all or not. This is useful, for example, when differentiating between 0/"" and unspecified.
Types ¶
type Bool ¶
Bool wraps the set of boolean flags.
func BuildOnly ¶
func BuildOnly() Bool
BuildOnly returns a boolean flag for building without a deployment
func GenerateName ¶
func GenerateName() Bool
GenerateName returns a boolean flag for generating an application name
func Push ¶ added in v0.0.311
func Push() Bool
Push returns a boolean flag to force pushing a build image to the registry
func RemoteOnly ¶
RemoteOnly returns a boolean flag for deploying remotely
type Duration ¶ added in v0.0.500
type Duration struct { Name string Shorthand string Description string Default time.Duration ConfName string EnvName string Hidden bool }
Duration wraps the set of duration flags.
type Flag ¶
type Flag interface {
// contains filtered or unexported methods
}
Flag wraps the set of flags.
type String ¶
type String struct { Name string Shorthand string Description string Default string ConfName string EnvName string Hidden bool }
String wraps the set of string flags.
func BuildTarget ¶ added in v0.0.337
func BuildTarget() String
func Dockerfile ¶ added in v0.0.335
func Dockerfile() String
func Ignorefile ¶ added in v0.0.433
func Ignorefile() String
func ImageLabel ¶ added in v0.0.337
func ImageLabel() String
type StringSlice ¶
type StringSlice struct { Name string Shorthand string Description string Default []string ConfName string EnvName string Hidden bool }
StringSlice wraps the set of string slice flags.
func BuildArg ¶ added in v0.0.337
func BuildArg() StringSlice
func BuildSecret ¶ added in v0.0.337
func BuildSecret() StringSlice