https://github.com/pacman82/io-arg
Conviniently accept either standard streams or file paths in CLI tools written in Rust as arguments.
https://github.com/pacman82/io-arg
Last synced: about 2 months ago
JSON representation
Conviniently accept either standard streams or file paths in CLI tools written in Rust as arguments.
- Host: GitHub
- URL: https://github.com/pacman82/io-arg
- Owner: pacman82
- License: mit
- Created: 2021-04-14T07:33:43.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-23T23:29:30.000Z (5 months ago)
- Last Synced: 2025-04-13T05:07:52.236Z (about 2 months ago)
- Language: Rust
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# IO Arg
Conviniently accept either standard streams or file paths in CLI tools written in Rust as arguments.
## Usage
```rust
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,
}
```