A light and fast library to create CLI apps. 🌙 🖤
Find a file
alyxshang 7b47aaf7a2
All checks were successful
/ test (push) Successful in 50s
Bug fixed.
2026-01-18 20:44:23 +01:00
.forgejo/workflows Nearly there. 2026-01-17 18:41:58 +01:00
src Bug fixed. 2026-01-18 20:44:23 +01:00
.gitignore Init. 2026-01-17 14:38:38 +01:00
Cargo.toml Final preflight checks. 2026-01-18 14:07:09 +01:00
LICENSE Init. 2026-01-17 14:38:38 +01:00
README.markdown v.0.1.0 2026-01-18 14:36:23 +01:00

YUE 🌙 🖤

A light and fast library to create CLI apps. 🌙 🖤

ABOUT 📚

This repository contains the source code for a library to create CLI apps. Yuè (月) is the Chinese word for "moon" and like the moon, this library should illuminate the way for you clearly when building CLI applications in Rust. This library is a rewrite of an old library, called Cliply, which was far less flexible.

FEATURES 💅

  • Built-in --help message.
  • Built-in --version message.
  • Support for the single minus syntax: -a.
  • Support for the combined minus syntax: -ab.
  • Support for the double-minus syntax: --arg.
  • Support for the no-minus syntax: arg.
  • Support for supplying data to an argument in each of the formats above.

INSTALLATION 📥

To add the Yuè crate to your Rust project add the following line to the dependencies section of your project's Cargo.toml:

yue = { git = "https://source.alyxshang.boo/alyxshang/yue", tag = "v.0.1.0" }

USAGE ⚒️

The code snippet below outlines how to create a CLI application using Yuè:

use yue::App;
use std::env::args;

fn main() {
    let mut app: App = App::new(
        "Test App",
        "0.1.0"
    );
    app.add_arg("greet", &false, "displays a greeting");
    app.add_arg("cgreet", &true, "displays a custom greeting");
    let mut stream: Vec<String> = std::env::args()
        .collect::<Vec<String>>();
    stream.remove(0);
    let _: () = app.parse_args(&stream)
        .expect("Could not parse arguments.");
    if app.arg_used("greet"){
        println!("Hello!");
    }
    else if app.arg_used("cgreet"){
        let data: String = app.get_arg_data("cgreet")
            .expect("Could not get argument data.");
        println!("Hello, {}!", data);
    }
    else {
        println!("{}", app.help_info());
    }
}

Please note that Yuè only accepts the collected vector of arguments supplied without the name of the exectuable being the first item in the vector of arguments.

More information on the entities inside this crate can be obtained by reading the API documentation of this crate. The documentation can be read by cloning this repository and running the command cargo doc --open from the root of the repository.

CHANGELOG ✒️

Version 0.1.0

  • Initial release.
  • Initial upload to Forgejo.

NOTE 📜

  • Yuè 🌙 🖤 by Alyx Shang 🖤.
  • Licensed under the FSL v1.