https://github.com/dryrust/clientele.rs
Clientele makes it easy to write superb command-line utilities in Rust that follow consistent best practices on Linux, macOS, and Windows.
https://github.com/dryrust/clientele.rs
clap cli rust
Last synced: 8 months ago
JSON representation
Clientele makes it easy to write superb command-line utilities in Rust that follow consistent best practices on Linux, macOS, and Windows.
- Host: GitHub
- URL: https://github.com/dryrust/clientele.rs
- Owner: dryrust
- License: unlicense
- Created: 2024-08-21T16:05:02.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-05T12:05:35.000Z (8 months ago)
- Last Synced: 2025-05-05T12:16:38.349Z (8 months ago)
- Topics: clap, cli, rust
- Language: Rust
- Homepage: https://crates.io/crates/clientele
- Size: 65.4 KB
- Stars: 16
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Codeowners: .github/CODEOWNERS
- Authors: AUTHORS
Awesome Lists containing this project
README
# Clientele.rs
[](https://unlicense.org)
[](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html)
[](https://crates.io/crates/clientele)
[](https://docs.rs/clientele/)
**Clientele** makes it easy to write superb command-line utilities in Rust
that follow consistent best practices on all target platforms including Linux,
macOS, and Windows. It packages and re-exports [`clap`], [`camino`],
[`dotenvy`], [`wild`], [`argfile`], and [`getenv`] into a single easy
dependency.
## ✨ Features
- Showcases how to structure a CLI program in Rust (see the [examples](#-examples)).
- Loads environment variables from `.env` files (using the [`dotenvy`] crate).
- Provides convenience getters for common variables (using the [`getenv`] crate).
- Expands wildcard arguments (globs) on Windows (using the [`wild`] crate).
- Expands @argfiles similarly to [`javac`] or Python (using the [`argfile`] crate).
- Defines a standard set of essential CLI options (using the [`clap`] crate).
- Provides the [`Utf8Path`] and [`Utf8PathBuf`] types (using the [`camino`] crate).
- Recommends use of the [`sysexits.h(3)`] exit codes (see [`sysexits.rs`]).
- Supports opting out of any feature using comprehensive feature flags.
- Adheres to the Rust API Guidelines in its [naming conventions].
- 100% free and unencumbered public domain software.
## 🛠️ Prerequisites
- [Rust](https://rust-lang.org) 1.81+
## ⬇️ Installation
### Installation via Cargo
```bash
cargo add clientele
```
### Installation in `Cargo.toml` (with all features enabled)
```toml
[dependencies]
clientele = "0.3"
```
### Installation in `Cargo.toml` (with only specific features enabled)
```toml
[dependencies]
clientele = { version = "0.3", default-features = false, features = ["dotenv"] }
```
## 👉 Examples
See [`lib/clientele/examples/skeleton/main.rs`] for a complete example.
### Importing the library
```rust
use clientele::*;
```
### Running the example
```bash
cargo run --example skeleton
```
## 📚 Reference
### Options
#### [`StandardOptions`]
```text
Options:
--color Set the color output mode [default: auto] [possible values: auto, always, never]
-d, --debug Enable debugging output
--license Show license information
-v, --verbose... Enable verbose output (may be repeated for more verbosity)
-V, --version Print version information
-h, --help Print help
```
## 👨💻 Development
```bash
git clone https://github.com/dryrust/clientele.rs.git
```
---
[](https://x.com/intent/post?url=https://github.com/dryrust/clientele.rs&text=Clientele.rs)
[](https://reddit.com/submit?url=https://github.com/dryrust/clientele.rs&title=Clientele.rs)
[](https://news.ycombinator.com/submitlink?u=https://github.com/dryrust/clientele.rs&t=Clientele.rs)
[](https://www.facebook.com/sharer/sharer.php?u=https://github.com/dryrust/clientele.rs)
[](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/dryrust/clientele.rs)
[naming conventions]: https://rust-lang.github.io/api-guidelines/naming.html
[`StandardOptions`]: https://docs.rs/clientele/latest/clientele/struct.StandardOptions.html
[`Utf8Path`]: https://docs.rs/camino/latest/camino/struct.Utf8Path.html
[`Utf8PathBuf`]: https://docs.rs/camino/latest/camino/struct.Utf8PathBuf.html
[`javac`]: https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#commandlineargfile
[`lib/clientele/examples/skeleton/main.rs`]: lib/clientele/examples/skeleton/main.rs
[`argfile`]: https://crates.io/crates/argfile
[`camino`]: https://crates.io/crates/camino
[`clap`]: https://crates.io/crates/clap
[`dotenvy`]: https://crates.io/crates/dotenvy
[`getenv`]: https://crates.io/crates/getenv
[`wild`]: https://crates.io/crates/wild
[`sysexits.h(3)`]: https://man7.org/linux/man-pages/man3/sysexits.h.3head.html
[`sysexits.rs`]: lib/clientele/src/sysexits.rs