flag

package
v0.0.431 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package flag implements flag-related functionality.

Index

Constants

View Source
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 Add

func Add(cmd *cobra.Command, flags ...Flag)

Add adds flag to cmd, binding them on v should v not be nil.

func Args

func Args(ctx context.Context) []string

Args is shorthand for FromContext(ctx).Args().

func FirstArg

func FirstArg(ctx context.Context) string

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

func FromContext(ctx context.Context) *pflag.FlagSet

FromContext returns the FlagSet ctx carries. It panics in case ctx carries no FlagSet.

func GetApp

func GetApp(ctx context.Context) string

GetApp is shorthand for GetString(ctx, AppName).

func GetAppConfigFilePath

func GetAppConfigFilePath(ctx context.Context) string

GetAppConfigFilePath is shorthand for GetString(ctx, AppConfigFilePathName).

func GetBool

func GetBool(ctx context.Context, name string) bool

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

func GetBuildOnly(ctx context.Context) bool

func GetDetach

func GetDetach(ctx context.Context) bool

func GetInt

func GetInt(ctx context.Context, name string) int

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 GetLocalOnly(ctx context.Context) bool

func GetOrg

func GetOrg(ctx context.Context) string

GetOrg is shorthand for GetString(ctx, OrgName).

func GetRegion

func GetRegion(ctx context.Context) string

GetRegion is shorthand for GetString(ctx, RegionName).

func GetRemoteOnly

func GetRemoteOnly(ctx context.Context) bool

func GetString

func GetString(ctx context.Context, name string) string

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

func GetStringSlice(ctx context.Context, name string) []string

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 GetYes

func GetYes(ctx context.Context) bool

GetYes is shorthand for GetBool(ctx, YesName).

func NewContext

func NewContext(ctx context.Context, fs *pflag.FlagSet) context.Context

NewContext derives a context that carries fs from ctx.

Types

type Bool

type Bool struct {
	Name        string
	Shorthand   string
	Description string
	Default     bool
	Hidden      bool
}

Bool wraps the set of boolean flags.

func BuildOnly

func BuildOnly() Bool

BuildOnly returns a boolean flag for building without a deployment

func Detach

func Detach() Bool

Detach returns a boolean flag for detaching during deployment

func GenerateName

func GenerateName() Bool

GenerateName returns a boolean flag for generating an application name

func LocalOnly

func LocalOnly() Bool

RemoteOnly returns a boolean flag for deploying remotely

func Nixpacks added in v0.0.362

func Nixpacks() Bool

func NoCache added in v0.0.337

func NoCache() Bool

func Now

func Now() Bool

Now returns a boolean flag for deploying immediately

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

func RemoteOnly(defaultValue bool) Bool

RemoteOnly returns a boolean flag for deploying remotely

func Yes

func Yes() Bool

Yes returns a yes bool flag.

type Flag

type Flag interface {
	// contains filtered or unexported methods
}

Flag wraps the set of flags.

type Int

type Int struct {
	Name        string
	Shorthand   string
	Description string
	Default     int
	Hidden      bool
}

Int wraps the set of int flags.

type Set added in v0.0.361

type Set []Flag

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 App

func App() String

App returns an app string flag.

func AppConfig

func AppConfig() String

AppConfig returns an app config string flag.

func BuildTarget added in v0.0.337

func BuildTarget() String

func Dockerfile added in v0.0.335

func Dockerfile() String

func Image

func Image() String

Image returns a Docker image config string flag.

func ImageLabel added in v0.0.337

func ImageLabel() String

func Org

func Org() String

Org returns an org string flag.

func Region

func Region() String

Region returns a region string flag.

func Strategy added in v0.0.362

func Strategy() 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

Jump to

Keyboard shortcuts

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