Function libaki_unbody::execute

source ·
pub fn execute(sioe: &RunnelIoe, prog_name: &str, args: &[&str]) -> Result<()>
Expand description

execute unbody

params:

  • sioe: stream in/out/err
  • program: program name. etc. “unbody”
  • args: parameter arguments.

return:

  • ok: ()
  • err: anyhow

Examples

Example 1: output head

Outputs first 2 lines.

use runnel::RunnelIoeBuilder;

let r = libaki_unbody::execute(&RunnelIoeBuilder::new().build(),
    "unbody", &["--head", "2"]);

Example 2: output tail

Outputs last 2 lines.

use runnel::RunnelIoeBuilder;

let r = libaki_unbody::execute(&RunnelIoeBuilder::new().build(),
    "unbody", &["--tail", "2"]);

Example 3: output head and tail

Outputs first 2 lines and last 2 lines.

use runnel::RunnelIoeBuilder;

let r = libaki_unbody::execute(&RunnelIoeBuilder::new().build(),
    "unbody", &["--head", "2", "--tail", "2"]);

Example 4: output body, except for head and tail

Outputs body, except for first 2 lines and last 2 lines.

use runnel::RunnelIoeBuilder;

let r = libaki_unbody::execute(&RunnelIoeBuilder::new().build(),
    "unbody", &["--head", "2", "--tail", "2", "--inverse"]);