coliru

A minimal, flexible, dotfile installer
git clone https://git.ashermorgan.net/coliru/
Log | Files | Refs | README

commit 00d2a20f978fef52090268d03dc61158c6f0bed7
parent 79ea5ca604b1d361d8ec3c47881b10fe08863d3b
Author: Asher Morgan <59518073+ashermorgan@users.noreply.github.com>
Date:   Fri,  5 Jul 2024 12:56:40 -0700

Improve CLI --help output

Diffstat:
Msrc/cli.rs | 30+++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/src/cli.rs b/src/cli.rs @@ -4,29 +4,41 @@ use clap::{Parser, ColorChoice}; use std::path::Path; use super::core::execute_manifest_file; +/// CLI about description +const HELP_ABOUT: &str = "A minimal, flexible, dotfile installer"; + +/// CLI examples to be appended to help output +const HELP_EXAMPLES: &str = "\ +Examples: + # Install dotfiles from manifest.yml with tags matching A && (B || C) && !D + coliru manifest.yml --tag-rules A B,C ^D + + # Install dotfiles from manifest.yml to user@hostname over SSH + coliru manifest.yml --tag-rules A B,C ^D --host user@hostname"; + /// Arguments to the coliru CLI #[derive(Parser, Debug)] -#[command(version, color=ColorChoice::Never, - about="A minimal, flexible, dotfile installer")] +#[command(version, color=ColorChoice::Never, arg_required_else_help=true, + about=HELP_ABOUT, after_help=HELP_EXAMPLES)] struct Args { - /// The path to the coliru YAML manifest file + /// The path to the coliru manifest file pub manifest: String, /// The set of tag rules to enforce - #[arg(short, long, num_args=0..)] + #[arg(short, long, value_name="RULE", num_args=0..)] pub tag_rules: Vec<String>, + /// Do a trial run without any permanent changes + #[arg(short = 'n', long)] + pub dry_run: bool, + /// Install dotfiles on another machine over SSH #[arg(long, default_value="", hide_default_value=true)] pub host: String, /// Interpret link commands as copy commands - #[arg(short, long)] + #[arg(long)] pub copy: bool, - - /// Do a trial run without any permanent changes - #[arg(short = 'n', long)] - pub dry_run: bool, } /// Runs the coliru CLI