Documentation
¶
Index ¶
- func Chdir() (err error)
- func CheckForFish() bool
- func DomainFlag(usage string) (*string, *pflag.Flag, ...)
- func EnvironmentFlag(usage string) (*string, *pflag.Flag, ...)
- func Main(cmd *cobra.Command, args []string) (context.Context, *awscfg.Config, *cobra.Command, []string, io.Writer)
- func MainRedirect(cmd *cobra.Command, args []string, w io.Writer) (context.Context, *awscfg.Config, *cobra.Command, []string, io.Writer)
- func NoCompletionFunc(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)
- func OverrideArgs(cmd *cobra.Command, args ...string)
- func ParentProcessName() (string, error)
- func PrintCredentials(format Format, creds aws.Credentials)
- func PrintCredentialsEnv(creds aws.Credentials, isFish bool)
- func PrintCredentialsExport(creds aws.Credentials, isFish bool)
- func PrintCredentialsExportWithHistory(creds aws.Credentials, isFish bool)
- func PrintCredentialsJSON(creds aws.Credentials)
- func PrintRoot()
- func ProcessName(pid int) (string, error)
- func QualityFlag(usage string) (*string, *pflag.Flag, ...)
- func QualityForEnvironment(environment string) string
- func QuietFlag() *pflag.Flag
- func RestoreArgs()
- func SetTPM(aws.Credentials) error
- func SetenvFromTPM(string) error
- func UndoChdir() error
- func WritableBinDirname() (string, error)
- type Format
- type FormatFlagError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chdir ¶
func Chdir() (err error)
Chdir changes the working directory to the value of the SUBSTRATE_ROOT environment variable, if set and non-empty. It returns the previous working directory and the error returned by os.Chdir.
func CheckForFish ¶
func CheckForFish() bool
CheckForFish finds the name of Substrate's parent process (ppid) and if it's the fish shell, return true.
func DomainFlag ¶
func EnvironmentFlag ¶
func Main ¶
func Main(cmd *cobra.Command, args []string) (context.Context, *awscfg.Config, *cobra.Command, []string, io.Writer)
Main returns the arguments necessary for a typical subcommand's Main function so that it can be called as Main(cmdutil.Main(cmd.Context())).
func MainRedirect ¶
func MainRedirect(cmd *cobra.Command, args []string, w io.Writer) (context.Context, *awscfg.Config, *cobra.Command, []string, io.Writer)
MainRedirect returns the arguments necessary for a typical subcommand's Main function with its output io.Writer redirected to w. Call the Main function as Main(cmdutil.MainRedirect(cmd.Context(), w)).
func NoCompletionFunc ¶
func OverrideArgs ¶
OverrideArgs provides a way to test main functions that use package-level flag functions to parse command-line arguments. It must be called _before_ calling and package-level flag functions.
func ParentProcessName ¶
ParentProcessName returns the name of the parent process of the current process.
func PrintCredentials ¶
func PrintCredentials(format Format, creds aws.Credentials)
func PrintCredentialsEnv ¶
func PrintCredentialsEnv(creds aws.Credentials, isFish bool)
func PrintCredentialsExport ¶
func PrintCredentialsExport(creds aws.Credentials, isFish bool)
func PrintCredentialsExportWithHistory ¶
func PrintCredentialsExportWithHistory(creds aws.Credentials, isFish bool)
func PrintCredentialsJSON ¶
func PrintCredentialsJSON(creds aws.Credentials)
func PrintRoot ¶
func PrintRoot()
PrintRoot prints the current working directory, which is the Substrate repository if this function is called after Chdir. This isn't just a part of Chdir because it's low-stakes and too much information for read-only commands but important enough to spend a line of output on for commands that e.g. create accounts, which all arrange to call PrintRoot.
func ProcessName ¶
ProcessName returns the process name of the process with the given pid.
func QualityFlag ¶
func QualityForEnvironment ¶
func RestoreArgs ¶
func RestoreArgs()
RestoreArgs puts everything back where it was. It should be called in a defer statement at the beginning of a test or benchmark function.
func SetTPM ¶
func SetTPM(aws.Credentials) error
Linux users have to suck it up and set environment variables.
func SetenvFromTPM ¶
func UndoChdir ¶
func UndoChdir() error
UndoChdir changes the working directory to whatever the working directory was before a prior call to Chdir. It panics if Chdir hasn't been called.
func WritableBinDirname ¶
WritableBinDirname tries to preempt common tar(1) failures we encounter when the extraction directory isn't writable for some reason. It returns a writable directory name and a nil error or the empty string and a non-nil error.
Types ¶
type FormatFlagError ¶
type FormatFlagError Format
func (FormatFlagError) Error ¶
func (err FormatFlagError) Error() string