Skip to main content

collect_input

Function collect_input 

Source
pub fn collect_input(
    stdin_flag: Option<&str>,
    cli_kwargs: HashMap<String, Value>,
    large_input: bool,
) -> Result<HashMap<String, Value>, CliError>
Expand description

Merge CLI keyword arguments with optional STDIN JSON.

Resolution order (highest priority first):

  1. CLI flags (non-Null values in cli_kwargs)
  2. STDIN JSON (when stdin_flag is Some("-"))

§Arguments

  • stdin_flagSome("-") to read from STDIN, None to skip
  • cli_kwargs — map of flag name → value (Null values are ignored)
  • large_input — if false, reject STDIN payloads exceeding 10 MiB

§Errors

Returns CliError (exit code 2) on oversized input, invalid JSON, or non-object JSON.