rust-cli

from pluginagentmarketplace/custom-plugin-rust

Rust programming language roadmap plugin for Claude

1 stars0 forksUpdated Jan 5, 2026
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-rust --skill rust-cli

SKILL.md

Rust CLI Skill

Build professional command-line applications with clap, colored output, and interactive features.

Quick Start

Basic CLI with Clap

[dependencies]
clap = { version = "4", features = ["derive"] }
anyhow = "1"
use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(name = "myapp", version, about)]
struct Cli {
    #[arg(short, long)]
    verbose: bool,

    #[command(subcommand)]
    command: Commands,
}

#[derive(Subcommand)]
enum Commands {
    Init { name: String },
    Build { #[arg(short, long)] release: bool },
}

fn main() -> anyhow::Result<()> {
    let cli = Cli::parse();

    match cli.command {
        Commands::Init { name } => println!("Creating: {}", name),
        Commands::Build { release } => println!("Building..."),
    }
    Ok(())
}

Colored Output

use colored::Colorize;

println!("{}", "Success!".green().bold());
println!("{}", "Error!".red());

Progress Bars

use indicatif::{ProgressBar, ProgressStyle};

let pb = ProgressBar::new(100);
pb.set_style(ProgressStyle::default_bar()
    .template("{bar:40} {pos}/{len}")?);

for _ in 0..100 {
    pb.inc(1);
}
pb.finish();

Interactive Prompts

use dialoguer::{Confirm, Input, Select};

let name: String = Input::new()
    .with_prompt("Project name")
    .interact_text()?;

if Confirm::new().with_prompt("Continue?").interact()? {
    // proceed
}

Common Patterns

Error Handling

fn main() {
    if let Err(e) = run() {
        eprintln!("{}: {}", "error".red(), e);
        std::process::exit(1);
    }
}

Testing CLI

use assert_cmd::Command;
use predicates::prelude::*;

#[test]
fn test_help() {
    Command::cargo_bin("myapp").unwrap()
        .arg("--help")
        .assert()
        .success();
}

Troubleshooting

ProblemSolution
Args not parsedAdd features = ["derive"]
Colors not showingCheck terminal support

Resources

Repository Stats

Stars1
Forks0
LicenseOther