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

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

#7 in #accept

Download history 78/week @ 2024-07-26 74/week @ 2024-08-02 423/week @ 2024-08-09 161/week @ 2024-08-16 85/week @ 2024-08-23 58/week @ 2024-08-30 149/week @ 2024-09-06 79/week @ 2024-09-13 74/week @ 2024-09-20 30/week @ 2024-09-27 136/week @ 2024-10-04 44/week @ 2024-10-11 46/week @ 2024-10-18 40/week @ 2024-10-25 41/week @ 2024-11-01 119/week @ 2024-11-08

249 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