Skip to main content

oxide_cli/cli/
commands.rs

1use clap::{Subcommand, arg};
2
3#[derive(Subcommand)]
4pub enum AddonCommands {
5  #[command(alias = "i", about = "Install and cache an addon")]
6  Install { addon_id: String },
7
8  #[command(alias = "l", about = "List installed addons")]
9  List,
10
11  #[command(alias = "r", about = "Remove a cached addon")]
12  Remove { addon_id: String },
13
14  #[command(alias = "p", about = "Publish a GitHub repository as an Oxide addon")]
15  Publish {
16    #[arg(help = "GitHub repository URL (e.g. https://github.com/owner/repo)")]
17    addon_url: String,
18  },
19
20  #[command(alias = "u", about = "Update a GitHub repository as an Oxide addon")]
21  Update {
22    #[arg(help = "GitHub repository URL (e.g. https://github.com/owner/repo)")]
23    addon_url: String,
24  },
25}
26
27#[derive(Subcommand)]
28pub enum TemplateCommands {
29  #[command(alias = "i", about = "Download and cache a template locally")]
30  Install {
31    #[arg(help = "Name of the template to install")]
32    template_name: String,
33  },
34
35  #[command(alias = "l", about = "List all locally installed templates")]
36  List,
37
38  #[command(
39    alias = "r",
40    about = "Remove an installed template from the local cache"
41  )]
42  Remove {
43    #[arg(help = "Name of the template to remove")]
44    template_name: String,
45  },
46
47  #[command(
48    alias = "p",
49    about = "Publish a GitHub repository as an Oxide template"
50  )]
51  Publish {
52    #[arg(help = "GitHub repository URL (e.g. https://github.com/owner/repo)")]
53    template_url: String,
54  },
55
56  #[command(alias = "u", about = "Update a GitHub repository as an Oxide template")]
57  Update {
58    #[arg(help = "GitHub repository URL (e.g. https://github.com/owner/repo)")]
59    template_url: String,
60  },
61}
62
63#[derive(Subcommand)]
64pub enum Commands {
65  #[command(alias = "n", about = "Create a new project from a template")]
66  New {
67    #[arg(help = "Name of the project directory to create")]
68    name: String,
69
70    #[arg(help = "Name of the template to use (e.g. react-vite-ts)")]
71    template_name: String,
72  },
73
74  #[command(alias = "t", about = "Manage templates")]
75  Template {
76    #[command(subcommand)]
77    command: TemplateCommands,
78  },
79
80  #[command(alias = "in", about = "Log in to your Oxide account")]
81  Login,
82
83  #[command(alias = "out", about = "Log out of your Oxide account")]
84  Logout,
85
86  #[command(about = "Show information about the currently logged-in account")]
87  Account,
88
89  #[command(alias = "a", about = "Manage addons")]
90  Addon {
91    #[command(subcommand)]
92    command: AddonCommands,
93  },
94
95  #[command(about = "Download and install the latest Oxide release")]
96  Upgrade,
97
98  #[command(about = "Install shell completions for: bash, zsh, fish, powershell")]
99  Completions {
100    #[arg(
101      value_name = "SHELL",
102      help = "Shell to install completions for: bash, zsh, fish, powershell"
103    )]
104    shell: String,
105  },
106
107  /// Hidden helper called by the generated completion scripts to produce dynamic completions.
108  /// Not shown in help output.
109  #[command(name = "_complete", hide = true)]
110  Complete {
111    /// Addon ID to list commands for. Omit to list all installed addon IDs.
112    addon_id: Option<String>,
113  },
114
115  #[command(external_subcommand)]
116  External(Vec<String>),
117}