1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(
name = "winbang",
version,
about = "Unix-like shebang support for Windows."
)]
pub struct Cli {
/// Force-rewrite Winbang's shell verb registry entries and exit.
#[arg(long)]
pub reinstall_verbs: bool,
#[command(subcommand)]
pub command: Option<Command>,
}
#[derive(Subcommand)]
pub enum Command {
/// (Internal) Handle a non-Open shell verb dispatched from the registry.
/// Not intended to be invoked directly by users.
#[command(hide = true)]
DispatchVerb {
#[arg(long)]
verb: String,
#[arg(long)]
file: PathBuf,
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
extras: Vec<String>,
},
/// Any non-subcommand first argument is treated as a script path; trailing
/// arguments are passed to the resolved interpreter.
#[command(external_subcommand)]
Script(Vec<String>),
}