Skip to main content

collect_input_from_reader

Function collect_input_from_reader 

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

Inner implementation: accepts any Read source for testability.

§Arguments

  • stdin_flagSome("-") to read from reader, anything else skips STDIN
  • cli_kwargs — map of flag name → value (Null values are dropped)
  • large_input — if false, reject payloads exceeding STDIN_SIZE_LIMIT_BYTES
  • reader — byte source to read from when stdin_flag == Some("-")

§Errors

Returns CliError on oversized input, invalid JSON, or non-object JSON.