Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Subprocess ¶
Subprocess is the default Factory: it runs argv as an external process, with argv[0] the program and argv[1:] its arguments. It is built on the framework's streaming subprocess engine (the same one cmd-exec and cmd-perl use), so a long-running child streams its output and is torn down on a downstream stop or cancellation.
func Xargs ¶
Xargs returns a Command with two modes. With no command to run it regroups: it splits each input line into fields and groups them into output lines of at most N fields (-n mode; default -n1, each field on its own line). With a command — positional arguments naming a program, or an injected XargsExec factory — it runs that command once per argument group, streaming each invocation's output (the GNU xargs exec behavior).
Types ¶
type Factory ¶
Factory turns one group's full argv into the command to run for that group. argv[0] is the program/command name; argv[1:] its arguments. Because it returns a gloo.Command, the factory uniformly covers both an external process (see Subprocess) and any gloo-foo command of any composed complexity.
type XargsExec ¶
type XargsExec Factory
XargsExec injects the factory used to build the command run for each group. When unset, a command named by positional arguments runs as a subprocess.
type XargsMaxArgs ¶
type XargsMaxArgs int
XargsMaxArgs is the -n flag: maximum number of fields per output line. When unset or <= 0, defaults to 1 (each field on its own line).
type XargsMaxProcs ¶
type XargsMaxProcs int
XargsMaxProcs is the -P flag: the maximum number of invocations to run concurrently. Output stays in input order regardless. Values <= 1 run one invocation at a time.
type XargsNull ¶
type XargsNull bool
XargsNull is the -0 flag: split input on NUL bytes instead of whitespace, so arguments may contain spaces and newlines.
type XargsReplace ¶
type XargsReplace string
XargsReplace is the -I flag: a replace-token substituted for each input line within the command template. Setting it forces one invocation per input line.