Skip to main content

load_command_input

Function load_command_input 

Source
pub fn load_command_input(
    args: &[String],
    stdin: impl Read,
) -> Result<Value, LoadError>
Expand description

Load a command Value from positional args or stdin.

Detection for a single positional arg:

  • .md{ "type": "markdown", "file": <path> } (path only; file not read)
  • .json → read file and parse JSON
  • otherwise → parse the argument as inline JSON

§Errors

Returns LoadError::Usage for invalid argv shapes or empty stdin, LoadError::Parse for invalid JSON, and LoadError::Io for read failures.