Description
Expand a caller-declared all-flag ASCII short-option cluster; does not infer which flags take values.
An argv vector already consists of literal argument strings. Shell quoting and tokenization happen before this representation; joining argv elements with spaces does not reconstruct a safe command string. Option aliases, duplicates, arity and dependencies are application policies that these tools take explicitly.
Expand a caller-declared all-flag ASCII short-option cluster; does not infer which flags take values.
When to use this tool
Use this tool to expand a caller-declared all-flag ASCII short-option cluster; does not infer which flags take values.
How to use the tool and how it works
- Enter token using the input definitions below.
- Run the operation. Resolve malformed-input errors before interpreting the result.
- Read result.flags. Interpret signs, units, ordering and null values using the rules below.
Require a minus followed by 1–128 ASCII letters. Return one single-letter minus-prefixed flag for each letter, preserving order and duplicates.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| token | One already-tokenized short-option or flag-cluster string in the stated ASCII grammar. | Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply. |
| Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.flags | Expanded minus-prefixed single-letter flags in token order. |
{
"input": {
"token": "-abc"
},
"output": {
"result": {
"flags": [
"-a",
"-b",
"-c"
]
}
}
} Limitations and assumptions
- The caller must know that every member is a flag; the tool does not infer value-taking options.
- Inputs are literal tokens or explicit records. The restricted long-name grammar is [A-Za-z0-9][A-Za-z0-9-]* where required. No universal option syntax, shell semantics or process execution is inferred.
- Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
- Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.
Alternative or Complementary methods
Use the application’s option schema to choose arity, aliases and conflict policy. Pass a literal argv vector to the intended process interface; shell command construction requires separate quoting rules.
References
Similar or alternative tools
- Short Option Attached Value Splitter
Split an explicit short-option attached-value token after its one ASCII option letter; no equals stripping or option-schema inference.
- Long Option Assignment Joiner
Format one literal long-option argv token under a restricted ASCII option-name grammar; returns one argument, not shell quoting.