Skip to content

Main content

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.

Loading tool…

Description

Split an explicit short-option attached-value token after its one ASCII option letter; no equals stripping or option-schema inference.

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.

Split an explicit short-option attached-value token after its one ASCII option letter; no equals stripping or option-schema inference.

When to use this tool

Use this tool to split an explicit short-option attached-value token after its one ASCII option letter; no equals stripping or option-schema inference.

How to use the tool and how it works

  1. Enter token using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.option, result.value. Interpret signs, units, ordering and null values using the rules below.

Require a minus sign, one ASCII letter and a nonempty attached suffix. Return the first two characters as option and every remaining character as value.1

Input fieldMeaning and unitsAccepted input
tokenOne 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 fieldInterpretation
resultObject containing the fields below.
result.optionSingle-letter option including its leading minus.
result.valueLiteral attached value; null means no long assignment while empty string means an explicit empty assignment.
json
{
  "input": {
    "token": "-Iinclude"
  },
  "output": {
    "result": {
      "option": "-I",
      "value": "include"
    }
  }
}

Limitations and assumptions

  • No equals sign is stripped: -x=a has value =a. Option arity and whether the token is actually a flag cluster are caller decisions.
  • 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

  1. Tool behavior and example: Short Option Attached Value Splitter — tool.io

Similar or alternative tools

  • Long Option Assignment Splitter

    Split one strict ASCII --long-name[=value] argv token at the first equals; no shell parsing or implicit next-token consumption.

  • Option Value Arity Audit

    Audit explicitly supplied value counts for each option occurrence against an inclusive arity range; no greedy token assignment.