#cli #shell #command-line #line-string #runner #run #full

bin+lib cli_runner

CLI runner library for Rust - run a full command line String

3 unstable releases

0.2.1 Jan 4, 2023
0.2.0 Jan 4, 2023
0.1.0 Jan 4, 2023

#17 in #line-string


Used in ibflex

GPL-3.0-or-later

15KB

CLI Runner

CLI runner library for Rust - run a full command line String

This is a library which makes it convenient to execute a command line String.

It is using shell_words crate to parse the command line, allowing it to accept a command as it would be issued in a shell.

This is a multi-platform library.

Example

use cli_runner::{run, get_stdout, get_stderr};

let cmd = "ls -alF";
let output = run(cmd);

assert!(output.status.success());

let so = get_stdout(&output);
assert!(!so.is_empty());

let se = get_stderr(&output);
assert!(se.is_empty());

Changes

See Changelog

License

See License


lib.rs:

  • CLI Runner
  • is a library which makes it convenient to execute a command line String.
  • It is using shell_words crate to parse the command line, allowing it to accept a command
  • as it would be issued in a shell.
  • This is a multi-platform library.
  • Example:
  • use cli_runner::{run, get_stdout, get_stderr};
  • let cmd = "ls -alF";
  • let output = run(cmd);
  • assert!(output.status.success());
  • let so = get_stdout(&output);
  • assert!(!so.is_empty());
  • let se = get_stderr(&output);
  • assert!(se.is_empty());
  • 
    

Dependencies

~19KB