command-stream 1.11.0

Modern shell command execution library with streaming, async iteration, and event support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! `cargo run --example fy_migrate` prints migrated automation source.
use command_stream::fy::{translate_source, SourceOptions};

fn main() -> Result<(), String> {
    let source = "import { $ } from 'zx';\nconst branch = (await $`git branch --show-current`).text().trim();\nconsole.log(branch);\n";
    let translated = translate_source(
        source,
        &SourceOptions {
            from: "zx".into(),
            ..Default::default()
        },
    )?;
    print!("{}", translated.code);
    for diagnostic in translated.diagnostics {
        eprintln!("{diagnostic}");
    }
    Ok(())
}