Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions crates/openshell-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -500,6 +501,7 @@ struct Cli {
/// Workspace scope for resource operations.
#[arg(
long,
visible_alias = "ws",
global = true,
env = "OPENSHELL_WORKSPACE",
default_value = "default",
Expand Down Expand Up @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion docs/how-it-works/gateways/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 `--gateway` (`-g` or `--gw` for short):

```shell
openshell status -g staging
Expand Down
4 changes: 2 additions & 2 deletions docs/how-it-works/workspaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 `--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
Expand Down
Loading