| Crates.io | io-arg |
| lib.rs | io-arg |
| version | 0.2.2 |
| created_at | 2021-04-14 07:40:33.256547+00 |
| updated_at | 2025-07-05 17:49:02.153675+00 |
| description | Conviniently accept either standard streams or file paths in CLI tools written in Rust as arguments. |
| homepage | |
| repository | https://github.com/pacman82/io-arg |
| max_upload_size | |
| id | 383670 |
| size | 28,065 |
Conviniently accept either standard streams or file paths in CLI tools written in Rust as arguments.
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,
}