cli/commands/serve.rs
1use clap::{Args, Subcommand};
2
3#[derive(Subcommand, Debug)]
4pub enum ServeCommands {
5 /// Install and start the local shine HTTP server as a user service
6 Install(ServeInstallCommand),
7 /// Start the local shine HTTP file server in the foreground
8 Start(ServeStartCommand),
9 /// Show whether the local shine HTTP user service is installed and loaded
10 Status,
11 /// Stop and remove the local shine HTTP user service
12 Uninstall,
13 /// Print the local URL for a managed HTTP resource
14 Url(ServeUrlCommand),
15}
16
17#[derive(Args, Debug)]
18pub struct ServeInstallCommand {
19 /// Local port to listen on
20 #[arg(long, default_value_t = 6174)]
21 pub port: u16,
22}
23
24#[derive(Args, Debug)]
25pub struct ServeStartCommand {
26 /// Local port to listen on
27 #[arg(long, default_value_t = 6174)]
28 pub port: u16,
29}
30
31#[derive(Args, Debug)]
32pub struct ServeUrlCommand {
33 /// Resource path under ~/.shine/http, e.g. app/surge/custom-rules.sgmodule
34 #[arg(value_name = "PATH")]
35 pub path: String,
36 /// Local port used by the shine HTTP server
37 #[arg(long, default_value_t = 6174)]
38 pub port: u16,
39}