zap_rs/
args.rs

1use clap::{Args, Parser, Subcommand};
2
3/// A command line interface to install AppImages
4#[derive(Debug, Parser)]
5#[command(version, about, long_about = None)]
6pub struct Cli {
7    #[command(subcommand)]
8    pub command: Command,
9}
10
11#[derive(Debug, Subcommand)]
12pub enum Command {
13    /// Installs an AppImage (alias: i)
14    #[command(name = "install", alias = "i")]
15    Install(InstallArgs),
16
17    /// Updates an AppImage (alias: u)
18    #[command(name = "update", alias = "u")]
19    Update(UpdateArgs),
20
21    /// Removes an AppImage (alias: rm)
22    #[command(name = "remove", alias = "rm")]
23    Remove(RemoveArgs),
24
25    /// List the installed AppImages (alias: ls)
26    #[command(name = "list", alias = "ls")]
27    List,
28}
29
30#[derive(Debug, Args)]
31pub struct InstallArgs {
32    pub appname: String,
33
34    /// Provide a repository slug, or a direct URL to an appimage.
35    #[arg(long)]
36    pub from: String,
37
38    /// Name of the executable
39    #[arg(long)]
40    pub executable: Option<String>,
41
42    /// Use --from as repository slug to fetch from GitHub
43    #[arg(long, default_value_t = false)]
44    pub github: bool,
45}
46
47#[derive(Debug, Args)]
48pub struct UpdateArgs {
49    pub appname: String,
50}
51
52#[derive(Debug, Args)]
53pub struct RemoveArgs {
54    pub appname: String,
55}