diff --git a/tools/unitctl/unitctl/src/unitctl.rs b/tools/unitctl/unitctl/src/unitctl.rs index 8db71b8f9..322031cf1 100644 --- a/tools/unitctl/unitctl/src/unitctl.rs +++ b/tools/unitctl/unitctl/src/unitctl.rs @@ -17,6 +17,7 @@ pub(crate) struct UnitCtl { help = "Path (unix:/var/run/unit/control.sock), tcp address with port (127.0.0.1:80), or URL" )] pub(crate) control_socket_addresses: Option>, + #[arg( required = false, default_missing_value = "1", @@ -26,6 +27,7 @@ pub(crate) struct UnitCtl { help = "Number of seconds to wait for control socket to become available" )] pub(crate) wait_time_seconds: Option, + #[arg( required = false, default_value = "3", @@ -35,6 +37,7 @@ pub(crate) struct UnitCtl { help = "Number of times to try to access control socket when waiting" )] pub(crate) wait_max_tries: Option, + #[command(subcommand)] pub(crate) command: Commands, } @@ -43,6 +46,7 @@ pub(crate) struct UnitCtl { pub(crate) enum Commands { #[command(about = "List all running Unit processes")] Instances(InstanceArgs), + #[command(about = "Open current Unit configuration in editor")] Edit { #[arg( @@ -55,11 +59,13 @@ pub(crate) enum Commands { )] output_format: OutputFormat, }, + #[command(about = "Import configuration from a directory")] Import { #[arg(required = true, help = "Directory to import from")] directory: PathBuf, }, + #[command(about = "Sends raw JSON payload to Unit")] Execute { #[arg( @@ -71,6 +77,7 @@ pub(crate) enum Commands { help = "Output format of the result" )] output_format: OutputFormat, + #[arg( required = false, global = true, @@ -79,17 +86,20 @@ pub(crate) enum Commands { help = "Input file (json, json5, cjson, hjson yaml, pem) to send to unit when applicable use - for stdin" )] input_file: Option, + #[arg( - help = "HTTP method to use (GET, POST, PUT, DELETE)", - required = true, - short = 'm', - long = "http-method", - value_parser = parse_http_method, + required = true, + short = 'm', + long = "http-method", + value_parser = parse_http_method, + help = "HTTP method to use (GET, POST, PUT, DELETE)", )] method: String, + #[arg(required = true, short = 'p', long = "path")] path: String, }, + #[command(about = "Get the current status of Unit")] Status { #[arg( @@ -102,6 +112,7 @@ pub(crate) enum Commands { )] output_format: OutputFormat, }, + #[command(about = "List active listeners")] Listeners { #[arg( @@ -114,6 +125,7 @@ pub(crate) enum Commands { )] output_format: OutputFormat, }, + #[command(about = "List all configured Unit applications")] App(ApplicationArgs),