Skip to main content

apply_output_pipeline

Function apply_output_pipeline 

Source
pub fn apply_output_pipeline(
    output: OutputResult,
    stages: &[String],
) -> Result<OutputResult>
Expand description

Apply a pipeline to existing output without flattening grouped data first.

Unlike apply_pipeline, this preserves the incoming OutputMeta.wants_copy bit when continuing an existing output flow.

Use this when the command already produced an OutputResult and later stages should inherit its render/document metadata instead of starting from scratch.

ยงExamples

use osp_cli::core::output_model::OutputResult;
use osp_cli::dsl::apply_output_pipeline;
use osp_cli::row;

let mut output = OutputResult::from_rows(vec![
    row! { "uid" => "alice" },
    row! { "uid" => "bob" },
]);
output.meta.wants_copy = true;

let limited = apply_output_pipeline(output, &["L 1".to_string()])?;

assert!(limited.meta.wants_copy);
assert_eq!(limited.as_rows().unwrap().len(), 1);