#file-path #input-output #input-file #arguments #command-line-arguments #stream #cli-input

io-arg

Conviniently accept either standard streams or file paths in CLI tools written in Rust as arguments

7 releases

0.2.1 Sep 29, 2022
0.2.0 Jul 15, 2022
0.1.4 Jul 15, 2022
0.1.1 Apr 25, 2021

#1789 in Command line utilities

Download history 1/week @ 2023-12-18 15/week @ 2023-12-25 55/week @ 2024-01-01 118/week @ 2024-01-08 27/week @ 2024-01-15 45/week @ 2024-01-22 23/week @ 2024-01-29 32/week @ 2024-02-05 52/week @ 2024-02-12 60/week @ 2024-02-19 46/week @ 2024-02-26 28/week @ 2024-03-04 49/week @ 2024-03-11 28/week @ 2024-03-18 24/week @ 2024-03-25 122/week @ 2024-04-01

226 downloads per month
Used in odbc2parquet

MIT license

8KB
93 lines

IO Arg

Conviniently accept either standard streams or file paths in CLI tools written in Rust as arguments.

Usage

use io_arg::IoArg;
use clap::Parser;

/// A command line tool taking a required input argument and an optional output argument.
#[derive(Debug, Parser)]
struct Cli {
    /// Path to input file. Set to "-" to use STDIN instead of a file.
    input: IoArg,
    /// Path to output file. Leave out or set to "-" to use STDOUT instead of a file.
    #[structopt(long, short = "o", default_value = "-")]
    output: IoArg,
}

lib.rs:

Conviniently handle and use IO arguments in your command line interface.

No runtime deps