io-arg

Crates.ioio-arg
lib.rsio-arg
version0.2.1
sourcesrc
created_at2021-04-14 07:40:33.256547
updated_at2022-09-29 19:51:40.628523
descriptionConviniently accept either standard streams or file paths in CLI tools written in Rust as arguments.
homepage
repositoryhttps://github.com/pacman82/io-arg
max_upload_size
id383670
size19,133
Markus Klein (pacman82)

documentation

https://docs.rs/io-arg/

README

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,
}
Commit count: 17

cargo fmt