package
0.0.0-20240422232310-6f3d57286155
Repository: https://github.com/leep-frog/command.git
Documentation: pkg.go.dev
# Functions
Arg creates an argument `command.Processor` that requires exactly one input.
AsCompleter converts the `command.Completion` object into a `Completer` interface.
Autocomplete returns the completion suggestions for the provided command.Node, `COMP_LINE`, and `passthroughArgs` (`passthroughArgs` are used for `Aliaser` statements).
Between [`ValidatorOption`] validates an argument is between two numbers.
BoolArg creates a boolean argument.
BoolCompleter is a completer for all boolean strings.
BoolFlag creates a `FlagInterface` for a boolean argument.
BoolValueFlag creates a boolean `FlagInterface` whose data value gets set to `trueValue` if the flag is provided.
BoolValuesFlag creates a boolean `FlagInterface` whose data value gets set to `trueValue` if the flag is provided.
BranchSynonyms converts a map from branching argument to synonyms to a branching synonym map.
CacheHistory is a `CacheOption` for specifying the number of command executions that should be saved.
CacheNode returns a node that caches any execution of downstream commands.
CompleterFromFunc returns a `Completer` object from the provided function.
CompleterList changes a single arg completer (`Completer[T]`) into a list arg completer (`Completer[[]T]`).
CompleterWithOpts sets the relevant options in the `command.Completion` object returned by the `Completer`.
Contains [`ValidatorOption`] validates an argument contains the provided string.
CreateFile creates a file from the provided string slice.
No description provided by the author
DataTransformer transforms the value in command.Data under `key` using the provided function.
No description provided by the author
DebugMode returns whether or not debug mode is active.
Default is an `ArgumentOption` that sets a default value for an `Arg` node.
DeferredCompleter returns an argument/flag `Completer` that defers completion until after the provided graph is run.
Description creates a `command.Processor` that adds a command description to the usage text.
Descriptionf is like `Description`, but with formatting options.
EchoExecuteData returns a `command.Processor` that sends the `command.ExecuteData` contents to stdout.
EchoExecuteDataf returns a `command.Processor` that sends the `command.ExecuteData` contents to stdout with the provided format.
EnvArg loads the provided environment variable's value into `command.Data`.
EQ [`ValidatorOption`] validates an argument equals `n`.
ExecutableProcessor returns a `command.Processor` that adds to the command's `Executable`.
Execute executes a node with the provided `command.Input` and `command.Output`.
FileArgument creates an `Argument` processor for a file object.
FileContents converts a filename into the file's contents.
FileDoesNotExist [`ValidatorOption`] validates the file or directory does not exist.
FileExists [`ValidatorOption`] validates the file or directory exists.
FileListArgument creates an `ArgList` node for file objects.
FileNumberInputTransformer transforms input arguments of the format "input.go:123" into ["input.go" "123"].
FileTransformer returns a transformer that transforms a string into its full file-path.
Flag creates a `FlagInterface` from argument info.
FlagProcessor returns a `command.Processor` that iterates over the remaining command line arguments and processes any flags that are present.
FunctionWrap sets command.ExecuteData.FunctionWrap to true.
GT [`ValidatorOption`] validates an argument is greater than `n`.
GTE [`ValidatorOption`] validates an argument is greater than or equal to `n`.
HiddenArg is an `ArgumentOption` that hides an argument from a command's usage text.
If runs the provided processor if the function argunment returns true in the relevant complete and execute contexts.
IfData runs `command.Processor` p if the argument name is present in command.Data.
IfElse runs `command.Processor` t if the function argunment returns true in the relevant complete and execute contexts.
IfElseData runs `command.Processor` t if the argument name is present in command.Data.
InList [`ValidatorOption`] validates an argument is one of the provided choices.
IsBranchingError returns whether or not the provided error is a branching error.
IsDir [`ValidatorOption`] validates an argument is a directory.
IsFile [`ValidatorOption`] validates an argument is a file.
IsNotEnoughArgsError returns whether or not the provided error is a `NotEnoughArgs` error.
IsRegex [`ValidatorOption`] validates an argument is a valid regex.
IsUsageError returns whether or not the provided error is a usage-related error.
IsValidationError returns whether or not the provided error is a validation error.
ItemizedListFlag creates a flag that can be set with separate flags (e.g.
Length [`ValidatorOption`] validates an argument is exactly length.
ListArg creates a list argument that requires at least `minN` arguments and at most `minN`+`optionalN` arguments.
ListFlag creates a `FlagInterface` from list argument info.
ListifyValidatorOption changes a single-arg validator (`ValidatorOption[T]`) to a list-arg validator (`ValidatorOption[[]T]`) for the same type.
ListUntil returns a `ListBreaker` node that breaks when any of the provided `ValidatorOptions` are not satisfied.
ListUntilSymbol returns an unbounded list node that ends when a specific symbol is parsed.
LT [`ValidatorOption`] validates an argument is less than `n`.
LTE [`ValidatorOption`] validates an argument is less than or equal to `n`.
MapArg returns a `command.Processor` that converts an input key into it's value.
MapFlag returns a `Flag` that converts an input key into it's value.
MatchesRegex [`ValidatorOption`] validates an argument matches the provided regexes.
MaxLength [`ValidatorOption`] validates an argument is at most `length` long.
MenuArg returns an `Arg` that is required to be one of the provided choices.
MenuFlag returns an `Arg` that is required to be one of the provided choices.
MinLength [`ValidatorOption`] validates an argument is at least `length` long.
Negative [`ValidatorOption`] validates an argument is negative.
NEQ [`ValidatorOption`] validates an argument does not equal `n`.
No description provided by the author
No description provided by the author
NodeRepeater is a `command.Processor` that runs the provided command.Node at least `minN` times and up to `minN + optionalN` times.
NonNegative [`ValidatorOption`] validates an argument is non-negative.
Not [`ValidatorOption`] inverts the provided validator.
NotEnoughArgs returns a custom error for when not enough arguments are provided to the command.
OptionalArg creates an argument `command.Processor` that accepts zero or one input arguments.
OptionalFlag is a flag that can accept an optional parameter.
Positive [`ValidatorOption`] validates an argument is positive.
PrintlnProcessor returns a `command.Processor` that runs `output.Stdoutln(v)`.
Prompt prompts the user for input.
ReadFile reads the file into a slice of strings.
RunArgumentCompleter generates a `command.Completion` object from the provided `Completer` and inputs.
RunArgumentCompletion generates a `command.Completion` object from the provided `command.Completion` and inputs.
RuntimeCaller is a `GetProcessor` that retrieves the filepath of the file that.
SerialNodes returns a graph that iterates serially over nodes with the provided `command.Processor` objects.
SetEnvVarProcessor returns a `command.Processor` that sets the environment variable to the provided value.
SetupOutputString returns the file contents, as a string slice, of the setup file for the command.
SetupOutputFile returns the name of the setup file for the command.
SetupOutputString returns the file contents, as a string, of the setup file for the command.
ShellCommandCompleter creates a completer object that completes a command graph with the output from the provided shell command.
ShellCommandCompleterWithOpts creates a completer object that completes a command graph with the output from the provided command info.
ShortcutNode wraps the provided node with a shortcut node.
ShortcutOpt is an `ArgumentOption` that checks for shortcut substitution.
SimpleCompleter returns a completer that suggests the provided strings for command autocompletion.
SimpleDistinctCompleter returns a completer that distinctly suggests the provided strings for command autocompletion.
SimpleExecutableProcessor returns a `command.Processor` that adds to the command's `Executable`.
SimpleProcessor creates a `command.Processor` from execution and completion functions.
Stat runs os.Stat on the provided file and returns (nil, nil) if the file does not exist.
StaticCLI returns a static CLI.
StaticCLIs returns a set of static CLIs.
StringListListProcessor parses a two-dimensional slice of strings, with each slice being separated by `breakSymbol`.
No description provided by the author
SuperSimpleProcessor returns a processor from a single function that is run in both the execution and completion contexts.
TransformerList changes a single-arg transformer (`Transformer[T]`) to a list-arg transformer (`Transformer[[]T]`).
UnsetEnvVarProcessor returns a `command.Processor` that unsets the environment variable.
# Constants
No description provided by the author
Runes are actually int32.
FlagStop is a string indicating that no further flag values should be processed.
GetwdKey is the `command.Data` key used by `Getwd`.
RuntimeCallerKey is the `command.Data` key used by `RuntimeCaller`.
# Variables
No description provided by the author
Getwd is a `GetProcessor` that retrieves the current working directory.
MultiFlagRegex is the regex used to determine a multi-flag (`-qwer -> -q -w -e -r`).
SetupArg is an argument that points to the filename containing the output of the Setup command.
ShortcutArg is the `Arg` used to check for shortcuts.
No description provided by the author
# Structs
Argument is a type that implements `command.Processor`.
BranchNode implements a node that branches on specific string arguments.
Complexecute (Complete for Execute) is an arg option for arg execution.
CustomSetter is an `ArgumentOption` to specify a custom setting function when setting argument data.
EchoExecuteDataProcessor is a `command.Processor` that outputs the current command.ExecuteData contents.
ExecuteErrNode creates a simple execution node from the provided error-able function.
FileCompleter is a `Completer` implementer specifically for file args.
FlagOptions contains optional data for flags.
GetProcessor is a simple interface that extends the `command.Processor` interface and allows users to use a single object both as a command.Processor and to retrieve data (similar to the `Arg` and `Flag` types).
ListBreaker is a type that implements `command.InputBreaker` as well as `ArgumentOtion[T]`.
MapFlargument is an `Argument` (or `Flag` if included in a `FlagProcessor(...)`) that retrieves data from a provided map.
No description provided by the author
ShellCommand can run the provided command `Contents` in the shell and stores the response as a value in data with the provided type and `ArgName`.
SimpleEdge implements the `Edge` interface and points to the provided `command.Node`.
SimpleNode implements the `command.Node` interface from a provided `command.Processor` and `Edge`.
Transformer is an `ArgumentOption` that transforms an argument.
ValidatorOption is an `ArgumentOption` and `BashOption` for validating arguments.
# Interfaces
ArgumentOption is an interface for modifying `Argument` objects.
CachableCLI is an interface for CLIs that can store cached executions.
CacheOption is an option interface for modifying `CacheNode` objects.
Completer is an autocompletion object that can be used as an `ArgumentOption`.
FlagInterface defines a flag argument that is parsed regardless of it's position in the provided command line arguments.
No description provided by the author
No description provided by the author
No description provided by the author
ShortcutCLI is the interface required for integrating with shortcut nodes.