Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ pub struct Cli {
/// Treat YAML input as multi-document (return array of documents)
#[arg(long = "yaml-multi")]
pub yaml_multi: bool,

/// Enable streaming mode for large files (processes elements one at a time)
#[arg(long = "stream")]
pub stream: bool,
}

impl Cli {
Expand Down Expand Up @@ -419,6 +423,11 @@ pub fn run(cli: &Cli) -> crate::error::Result<()> {
let in_fmt = cli.resolve_input_format()?;
let out_fmt = cli.resolve_output_format()?;

// Streaming mode: process elements one at a time for large files
if cli.stream && crate::streaming::can_stream(in_fmt, out_fmt) {
return crate::streaming::run_streaming(cli, in_fmt, out_fmt, mapping_program.as_ref());
}

let input_data = read_input(cli)?;
let value = parse_input_with_cli(&input_data, in_fmt, Some(cli))?;

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ pub mod cli;
pub mod error;
pub mod formats;
pub mod mapping;
pub mod streaming;
pub mod value;
Loading