Skip to content

Commit 001211a

Browse files
committed
fix(cli): use --name flag in gateway destroy hint messages
The gateway destroy command accepts the gateway name via --name flag, not as a positional argument. Hint messages shown in error diagnostics were using positional syntax (e.g. 'openshell gateway destroy openshell') which produces 'error: unexpected argument found' when copy-pasted.
1 parent cdd5978 commit 001211a

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

crates/openshell-bootstrap/src/errors.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ fn diagnose_corrupted_state(gateway_name: &str) -> GatewayFailureDiagnosis {
176176
recovery_steps: vec![
177177
RecoveryStep::with_command(
178178
"Destroy and recreate the gateway",
179-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
179+
format!(
180+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
181+
),
180182
),
181183
RecoveryStep::with_command(
182184
"If that fails, remove the volume for a clean slate",
@@ -226,7 +228,7 @@ fn diagnose_port_conflict(_gateway_name: &str) -> GatewayFailureDiagnosis {
226228
),
227229
RecoveryStep::with_command(
228230
"Or stop other openshell gateways",
229-
"openshell gateway list && openshell gateway destroy <name>",
231+
"openshell gateway list && openshell gateway destroy --name <name>",
230232
),
231233
],
232234
retryable: false,
@@ -276,7 +278,9 @@ fn diagnose_k3s_dns_proxy_failure(gateway_name: &str) -> GatewayFailureDiagnosis
276278
RecoveryStep::with_command("Prune Docker networks", "docker network prune -f"),
277279
RecoveryStep::with_command(
278280
"Destroy and recreate the gateway",
279-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
281+
format!(
282+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
283+
),
280284
),
281285
],
282286
retryable: true,
@@ -341,7 +345,9 @@ fn diagnose_node_pressure(gateway_name: &str) -> GatewayFailureDiagnosis {
341345
),
342346
RecoveryStep::with_command(
343347
"Destroy and recreate the gateway after freeing resources",
344-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
348+
format!(
349+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
350+
),
345351
),
346352
],
347353
retryable: false,
@@ -364,7 +370,9 @@ fn diagnose_missing_supervisor(gateway_name: &str) -> GatewayFailureDiagnosis {
364370
),
365371
RecoveryStep::with_command(
366372
"Destroy and recreate the gateway with the updated image",
367-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
373+
format!(
374+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
375+
),
368376
),
369377
RecoveryStep::new(
370378
"Or set OPENSHELL_CLUSTER_IMAGE to a cluster image version that includes \
@@ -383,7 +391,7 @@ fn diagnose_certificate_issue(gateway_name: &str) -> GatewayFailureDiagnosis {
383391
.to_string(),
384392
recovery_steps: vec![RecoveryStep::with_command(
385393
"Destroy and recreate the gateway to regenerate certificates",
386-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
394+
format!("openshell gateway destroy --name {gateway_name} && openshell gateway start"),
387395
)],
388396
retryable: false,
389397
}
@@ -436,7 +444,9 @@ pub fn generic_failure_diagnosis(gateway_name: &str) -> GatewayFailureDiagnosis
436444
recovery_steps: vec![
437445
RecoveryStep::with_command(
438446
"Try destroying and recreating the gateway",
439-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
447+
format!(
448+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
449+
),
440450
),
441451
RecoveryStep::with_command(
442452
"Check container logs for details",

crates/openshell-bootstrap/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ where
280280
return Err(miette::miette!(
281281
"Gateway '{name}' already exists (container_running={}).\n\
282282
Use --recreate to destroy and redeploy, or destroy it first with:\n\n \
283-
openshell gateway destroy {name}",
283+
openshell gateway destroy --name {name}",
284284
existing.container_running,
285285
));
286286
}

crates/openshell-cli/src/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ pub async fn sandbox_create(
18481848
eprintln!();
18491849
eprintln!(
18501850
" {} && {}",
1851-
format!("openshell gateway destroy {gateway_name}").cyan(),
1851+
format!("openshell gateway destroy --name {gateway_name}").cyan(),
18521852
"openshell gateway start".cyan(),
18531853
);
18541854
eprintln!();

0 commit comments

Comments
 (0)