Documentation
¶
Index ¶
- Constants
- Variables
- func CleanExecPath(path string) string
- func CommandFileConflict(app, name, hint string) error
- func DetectWidth(w io.Writer) int
- func ExitCode(err error) int
- func HasFileConflict(name string) bool
- func IsExitCodeOnly(err error) bool
- func IsHelpArg(arg string) bool
- func NewExecClient(version string, f ExecFlags) (*httpx.Client, func() error, error)
- func ParseCompareTargets(raw string) ([]string, error)
- func ParseRunDoc(src RunSource) (*restfile.Document, error)
- func PrintFlagDefaults(w io.Writer, fs *FlagSet)
- func PrintFlagSetUsage(w io.Writer, app string, fs *FlagSet)
- func StdinRunPath(workspace string) string
- func UsageError(err error) error
- func WriteRunRequestChoices(w io.Writer, path string, choices []RunRequestChoice) error
- func WriteTextStyled(w io.Writer, rep *runfmt.Report, color termcolor.Config, def *theme.Definition) error
- type ExecConfig
- type ExecFlags
- func (f *ExecFlags) Bind(fs *FlagSet)
- func (f *ExecFlags) BindTelemetryFlags(fs *FlagSet)
- func (f ExecFlags) Resolve(filePath string) (ExecConfig, error)
- func (f ExecFlags) ResolveSession(filePath string) (ExecConfig, error)
- func (f ExecFlags) TelemetryConfig(version string) telemetry.Config
- func (f ExecFlags) ValidateEnvFlag() error
- type ExitErr
- type FlagSet
- func (f *FlagSet) Arg(i int) string
- func (f *FlagSet) Args() []string
- func (f *FlagSet) BoolVarAliases(dst *bool, value bool, usage string, names ...string)
- func (f *FlagSet) DurationVarAliases(dst *time.Duration, value time.Duration, usage string, names ...string)
- func (f *FlagSet) IntVarAliases(dst *int, value int, usage string, names ...string)
- func (f *FlagSet) NArg() int
- func (f *FlagSet) Parse(args []string) error
- func (f *FlagSet) StringListVarAliases(dst *[]string, usage string, names ...string)
- func (f *FlagSet) StringVar(dst *string, name, value, usage string)
- func (f *FlagSet) StringVarAliases(dst *string, value, usage string, names ...string)
- func (f *FlagSet) UnexpectedArgs() error
- func (f *FlagSet) WasSet(name string) bool
- type GroupFlags
- type RecordFlags
- type RunRequestChoice
- type RunRequestPromptOptions
- type RunSource
Constants ¶
const ExitUsage = 2
ExitUsage is the status for a bad flag, a missing argument, or an unknown subcommand.
const MaxTextWidth = 100
MaxTextWidth caps wrapped CLI text output at a readable line length.
Variables ¶
var ErrHelp = flag.ErrHelp
ErrHelp is returned when Parse sees -h or --help.
var ErrRunRequestChoiceCanceled = errors.New("request selection canceled")
Functions ¶
func CleanExecPath ¶ added in v0.28.1
func CommandFileConflict ¶
func DetectWidth ¶ added in v0.46.1
DetectWidth resolves the terminal width. COLUMNS overrides everything, otherwise writer, the standard streams and finally /dev/tty are probed so a redirected stderr still yields the real width. defaultWidth is the last resort.
func HasFileConflict ¶
func IsExitCodeOnly ¶ added in v0.36.1
IsExitCodeOnly reports whether err is only an exit-code carrier.
Commands use this after they have already written their output and need to return a non-zero process status without producing another stderr diagnostic.
func IsHelpArg ¶ added in v1.11.0
IsHelpArg matches -h and --help exactly because -H can be a real flag.
func NewExecClient ¶ added in v0.28.1
func ParseCompareTargets ¶
func PrintFlagDefaults ¶ added in v0.39.4
func StdinRunPath ¶ added in v0.28.1
StdinRunPath gives stdin-backed runs a stable request-file path so relative resolution still has a workspace anchor.
func UsageError ¶ added in v1.13.1
func WriteRunRequestChoices ¶ added in v0.28.1
func WriteRunRequestChoices( w io.Writer, path string, choices []RunRequestChoice, ) error
func WriteTextStyled ¶ added in v0.29.2
func WriteTextStyled( w io.Writer, rep *runfmt.Report, color termcolor.Config, def *theme.Definition, ) error
WriteTextStyled writes a runfmt text report with CLI-owned ANSI styling.
Types ¶
type ExecConfig ¶ added in v0.28.1
type ExecFlags ¶ added in v0.28.1
type ExecFlags struct {
EnvName string
EnvFile string
Workspace string
Timeout time.Duration
Insecure bool
Follow bool
ProxyURL string
MaxResponseSize string
MaxRedirects int
Recursive bool
CompareTargetsRaw string
CompareBaseline string
CompareGroup string
EnvGroups GroupFlags
// contains filtered or unexported fields
}
func NewExecFlags ¶ added in v0.28.1
func NewExecFlags() ExecFlags
func (*ExecFlags) BindTelemetryFlags ¶ added in v0.28.1
func (ExecFlags) Resolve ¶ added in v0.28.1
func (f ExecFlags) Resolve(filePath string) (ExecConfig, error)
Resolve builds a run configuration and requires a valid environment file.
func (ExecFlags) ResolveSession ¶ added in v1.2.1
func (f ExecFlags) ResolveSession(filePath string) (ExecConfig, error)
ResolveSession builds an editor configuration. Parse errors are returned in Env.FileErr so the editor can open the file, while other load errors remain fatal. Requests stay blocked until the file parses successfully.
func (ExecFlags) TelemetryConfig ¶ added in v0.28.1
func (ExecFlags) ValidateEnvFlag ¶ added in v0.28.1
type FlagSet ¶ added in v1.5.6
FlagSet accepts flags before or after positional arguments. String flags are trimmed.
func NewFlagSet ¶
func (*FlagSet) Args ¶ added in v1.5.6
Args returns the positional arguments in their original order.
func (*FlagSet) BoolVarAliases ¶ added in v1.5.6
func (*FlagSet) DurationVarAliases ¶ added in v1.5.6
func (*FlagSet) IntVarAliases ¶ added in v1.5.6
func (*FlagSet) Parse ¶ added in v1.5.6
Parse accepts flags before or after positional arguments until "--".
func (*FlagSet) StringListVarAliases ¶ added in v1.5.6
func (*FlagSet) StringVarAliases ¶ added in v1.5.6
func (*FlagSet) UnexpectedArgs ¶ added in v1.5.6
UnexpectedArgs returns an error if the command received positional arguments.
type GroupFlags ¶ added in v0.49.1
func (*GroupFlags) Set ¶ added in v0.49.1
func (f *GroupFlags) Set(value string) error
func (GroupFlags) String ¶ added in v0.49.1
func (f GroupFlags) String() string
type RecordFlags ¶ added in v1.8.0
func NewRecordFlags ¶ added in v1.8.0
func NewRecordFlags() RecordFlags
func (*RecordFlags) Bind ¶ added in v1.8.0
func (f *RecordFlags) Bind(fs *FlagSet)
type RunRequestChoice ¶ added in v0.28.1
func BuildRunRequestChoices ¶ added in v0.28.1
func BuildRunRequestChoices(doc *restfile.Document) []RunRequestChoice
func PromptRunRequestChoice ¶ added in v0.28.1
func PromptRunRequestChoice( r io.Reader, w io.Writer, path string, choices []RunRequestChoice, opt RunRequestPromptOptions, ) (RunRequestChoice, error)
type RunRequestPromptOptions ¶ added in v0.28.1
type RunRequestPromptOptions struct {
TTY bool
Color termcolor.Config
Theme *theme.Definition
}