From 90bc53de5313c36916fa17bfb07617ddf7559d45 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Thu, 3 Dec 2026 11:34:38 -0800 Subject: [PATCH 1/2] feat(cli): add --gw and --ws aliases for --gateway and --workspace Closes #6200 Signed-off-by: Jim Meyer --- crates/openshell-cli/src/main.rs | 31 +++++++++++++++++++++++++ docs/how-it-works/gateways/overview.mdx | 2 +- docs/how-it-works/workspaces.mdx | 4 ++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/crates/openshell-cli/src/main.rs b/crates/openshell-cli/src/main.rs index 5cca485033..0a5a4dcaba 100644 --- a/crates/openshell-cli/src/main.rs +++ b/crates/openshell-cli/src/main.rs @@ -470,6 +470,7 @@ struct Cli { /// Gateway name to operate on (resolved from stored metadata). #[arg( long, + visible_alias = "gw", short = 'g', global = true, env = "OPENSHELL_GATEWAY", @@ -500,6 +501,7 @@ struct Cli { /// Workspace scope for resource operations. #[arg( long, + visible_alias = "ws", global = true, env = "OPENSHELL_WORKSPACE", default_value = "default", @@ -4644,6 +4646,35 @@ mod tests { use std::ffi::OsString; use std::fs; + #[test] + fn gateway_and_workspace_flag_aliases_parse() { + let cli = Cli::try_parse_from([ + "openshell", + "--gw", + "prod", + "--ws", + "team-a", + "sandbox", + "list", + ]) + .expect("aliases should parse before the subcommand"); + assert_eq!(cli.gateway.as_deref(), Some("prod")); + assert_eq!(cli.workspace, "team-a"); + + let cli = Cli::try_parse_from([ + "openshell", + "sandbox", + "list", + "--gw", + "prod", + "--ws", + "team-a", + ]) + .expect("aliases should parse after the subcommand"); + assert_eq!(cli.gateway.as_deref(), Some("prod")); + assert_eq!(cli.workspace, "team-a"); + } + #[test] fn policy_update_parses_explicit_l7_scope_and_endpoint_path() { let cli = Cli::try_parse_from([ diff --git a/docs/how-it-works/gateways/overview.mdx b/docs/how-it-works/gateways/overview.mdx index 093f73517a..576be7701a 100644 --- a/docs/how-it-works/gateways/overview.mdx +++ b/docs/how-it-works/gateways/overview.mdx @@ -107,7 +107,7 @@ Switch the active gateway: openshell gateway select production ``` -Override the active gateway for a single command with `-g`: +Override the active gateway for a single command with `-g` or `--gateway`. `--gw` is an alias for `--gateway`: ```shell openshell status -g staging diff --git a/docs/how-it-works/workspaces.mdx b/docs/how-it-works/workspaces.mdx index a9753d3396..db26453606 100644 --- a/docs/how-it-works/workspaces.mdx +++ b/docs/how-it-works/workspaces.mdx @@ -170,8 +170,8 @@ change labels after creation. ## Target a Workspace -Pass `--workspace` to scope a resource operation. The flag is global, so it -can appear before or after the subcommand. +Pass `--workspace` (or its alias `--ws`) to scope a resource operation. The +flag is global, so it can appear before or after the subcommand. ```shell openshell sandbox list --workspace team-ml From ab4a041d42cb16edeb96259ce43dbdad8f385b41 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Thu, 3 Dec 2026 15:59:59 -0800 Subject: [PATCH 2/2] docs(cli): reword gateway and workspace alias mentions Signed-off-by: Jim Meyer --- docs/how-it-works/gateways/overview.mdx | 2 +- docs/how-it-works/workspaces.mdx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/how-it-works/gateways/overview.mdx b/docs/how-it-works/gateways/overview.mdx index 576be7701a..42f28c2c32 100644 --- a/docs/how-it-works/gateways/overview.mdx +++ b/docs/how-it-works/gateways/overview.mdx @@ -107,7 +107,7 @@ Switch the active gateway: openshell gateway select production ``` -Override the active gateway for a single command with `-g` or `--gateway`. `--gw` is an alias for `--gateway`: +Override the active gateway for a single command with `--gateway` (`-g` or `--gw` for short): ```shell openshell status -g staging diff --git a/docs/how-it-works/workspaces.mdx b/docs/how-it-works/workspaces.mdx index db26453606..5cb166a257 100644 --- a/docs/how-it-works/workspaces.mdx +++ b/docs/how-it-works/workspaces.mdx @@ -170,8 +170,8 @@ change labels after creation. ## Target a Workspace -Pass `--workspace` (or its alias `--ws`) to scope a resource operation. The -flag is global, so it can appear before or after the subcommand. +Pass `--workspace` (or `--ws`) to scope a resource operation. The flag is +global, so it can appear before or after the subcommand. ```shell openshell sandbox list --workspace team-ml