Documentation ¶
Overview ¶
Package command implements helpers useful for when building cobra commands.
Package command implements helpers useful for when building cobra commands. This source file contains logic common to `fly machine run` and `fly console`
Index ¶
- Variables
- func AnnotateCommand(cmd *cobra.Command, key, value string)
- func ChangeWorkingDirectory(ctx context.Context, wd string) (context.Context, error)
- func ChangeWorkingDirectoryToFirstArgIfPresent(ctx context.Context) (context.Context, error)
- func DetermineImage(ctx context.Context, appName string, imageOrPath string) (img *imgsrc.DeploymentImage, err error)
- func DetermineMounts(ctx context.Context, mounts []fly.MachineMount, region string) ([]fly.MachineMount, error)
- func DetermineServices(ctx context.Context, services []fly.MachineService) ([]fly.MachineService, error)
- func ExcludeFromMetrics(ctx context.Context) (context.Context, error)
- func FilesFromCommand(ctx context.Context) ([]*fly.File, error)
- func FromContext(ctx context.Context) *cobra.Command
- func IsAppsV1Command(cmd *cobra.Command) bool
- func LoadAppConfigIfPresent(ctx context.Context) (context.Context, error)
- func LoadAppNameIfPresent(ctx context.Context) (context.Context, error)
- func LoadAppNameIfPresentNoFlag(ctx context.Context) (context.Context, error)
- func New(usage, short, long string, fn Runner, p ...preparers.Preparer) *cobra.Command
- func NewContext(ctx context.Context, cmd *cobra.Command) context.Context
- func RequireAppName(ctx context.Context) (context.Context, error)
- func RequireAppNameNoFlag(ctx context.Context) (context.Context, error)
- func RequireSession(ctx context.Context) (context.Context, error)
- func TagV1Command(cmd *cobra.Command)
- type Runner
Constants ¶
This section is empty.
Variables ¶
var ErrRequireAppName = fmt.Errorf("the config for your app is missing an app name, add an app field to the fly.toml file or specify with the -a flag")
Functions ¶
func AnnotateCommand ¶ added in v0.1.85
func ChangeWorkingDirectory ¶ added in v0.0.452
func DetermineImage ¶ added in v0.1.102
func DetermineMounts ¶ added in v0.1.102
func DetermineMounts(ctx context.Context, mounts []fly.MachineMount, region string) ([]fly.MachineMount, error)
func DetermineServices ¶ added in v0.1.102
func DetermineServices(ctx context.Context, services []fly.MachineService) ([]fly.MachineService, error)
func ExcludeFromMetrics ¶ added in v0.1.3
func FilesFromCommand ¶ added in v0.1.102
FilesFromCommand checks the specified flags for files and returns a list of fly.File to be used in the machine configuration.
func FromContext ¶
FromContext returns the Command ctx carries. It panics in case ctx carries no Command.
func IsAppsV1Command ¶ added in v0.1.85
func LoadAppConfigIfPresent ¶
LoadAppConfigIfPresent is a Preparer which loads the application's configuration file from the path the user has selected via command line args or the current working directory.
func LoadAppNameIfPresent ¶
LoadAppNameIfPresent is a Preparer which adds app name if the user has used --app or there appConfig but unlike RequireAppName it does not error if the user has not specified an app name.
func LoadAppNameIfPresentNoFlag ¶ added in v0.1.41
LoadAppNameIfPresentNoFlag is like LoadAppNameIfPresent, but it does not check for the --app flag.
func NewContext ¶
NewContext derives a context that carries cmd from ctx.
func RequireAppName ¶
RequireAppName is a Preparer which makes sure the user has selected an application name via command line arguments, the environment or an application config file (fly.toml). It embeds LoadAppConfigIfPresent.
func RequireAppNameNoFlag ¶ added in v0.1.39
RequireAppNameNoFlag is a Preparer which makes sure the user has selected an application name via the environment or an application config file (fly.toml). It embeds LoadAppConfigIfPresent.
Identical to RequireAppName but does not check for the --app flag.
func RequireSession ¶
RequireSession is a Preparer which makes sure a session exists.
func TagV1Command ¶ added in v0.1.85
Types ¶
Directories ¶
Path | Synopsis |
---|---|
Package agent implements the agent command chain.
|
Package agent implements the agent command chain. |
Package apps implements the apps command chain.
|
Package apps implements the apps command chain. |
Package auth implements the auth command chain.
|
Package auth implements the auth command chain. |
Package curl implements the curl command chain.
|
Package curl implements the curl command chain. |
Package dig implements the dig command chain.
|
Package dig implements the dig command chain. |
Package docs implements the docs command chain.
|
Package docs implements the docs command chain. |
Package doctor implements the doctor command chain.
|
Package doctor implements the doctor command chain. |
Package logs implements the logs command chain.
|
Package logs implements the logs command chain. |
Package history implements the history command chain.
|
Package history implements the history command chain. |
Package lfsc implements the LiteFS Cloud command chain.
|
Package lfsc implements the LiteFS Cloud command chain. |
Package logs implements the logs command chain.
|
Package logs implements the logs command chain. |
Package platform implements the platform command chain.
|
Package platform implements the platform command chain. |
Package root implements the root command.
|
Package root implements the root command. |
Package status implements the status command chain.
|
Package status implements the status command chain. |
Package version implements the version command chain.
|
Package version implements the version command chain. |