From 41f91fd42c166656c9fac9f0ffeb84bff4fef3e1 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 25 Jul 2024 17:25:02 +0200 Subject: [PATCH] termproxy: avoid gluing words together in CLI option names Separate auth-port and auth-socket with a minus to make them easier to read. Fallback to the old style for `authport` which is pre-existing and used by, e.g. PBS. As the second option, now named `auth-socket`, got only introduced very recently and was not shipped in any package, we can ignore backwards compat for it. Update and slightly rework the usage output too. Note that even though this is an internal tool the cost doing so is small and it can only help, e.g. on using this manually and/or during debugging. Signed-off-by: Thomas Lamprecht --- termproxy/src/cli.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/termproxy/src/cli.rs b/termproxy/src/cli.rs index e8a12b2..9a451db 100644 --- a/termproxy/src/cli.rs +++ b/termproxy/src/cli.rs @@ -11,8 +11,8 @@ Arguments: ... The command to run connected via a proxied pty Options: - --authport Port to relay auth-request, default 85 - --authsocket Unix socket to relay auth-request (conflicts with --authport) + --auth-port Port to relay auth-request, default 85 + --auth-socket Unix socket to relay auth-request (conflicts with --auth-port) --port-as-fd Use as file descriptor. --path ACL object path to test on. --perm Permission to test. @@ -91,7 +91,12 @@ impl Options { let acl_path = args.value_from_str("--path")?; let acl_permission = args.opt_value_from_str("--perm")?; let api_daemon_address = { - let auth_port: Option = args.opt_value_from_str("--authport")?; + // TODO: remove with next major releases based on Debian trixie, after checking if all + // product switched to new auth-port variant! + let legacy_authport: Option = args.opt_value_from_str("--authport")?; + let auth_port: Option = args + .opt_value_from_str("--auth-port")? + .or_else(|| legacy_authport); let auth_socket: Option = args.opt_value_from_str("--auth-socket")?; match (auth_port, auth_socket) { (Some(auth_port), None) => DaemonAddress::Port(auth_port),