Skip to content

Commit 085b131

Browse files
authored
fix(cli): use --name flag in gateway destroy help messages (#368)
Error messages and recovery hints were showing 'openshell gateway destroy <name>' as a positional argument, but the CLI defines name as a --name flag. This caused 'unexpected argument' errors when users copied the suggested commands.
1 parent 475ee16 commit 085b131

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
@@ -180,7 +180,9 @@ fn diagnose_corrupted_state(gateway_name: &str) -> GatewayFailureDiagnosis {
180180
recovery_steps: vec![
181181
RecoveryStep::with_command(
182182
"Destroy and recreate the gateway",
183-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
183+
format!(
184+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
185+
),
184186
),
185187
RecoveryStep::with_command(
186188
"If that fails, remove the volume for a clean slate",
@@ -230,7 +232,7 @@ fn diagnose_port_conflict(_gateway_name: &str) -> GatewayFailureDiagnosis {
230232
),
231233
RecoveryStep::with_command(
232234
"Or stop other openshell gateways",
233-
"openshell gateway list && openshell gateway destroy <name>",
235+
"openshell gateway list && openshell gateway destroy --name <name>",
234236
),
235237
],
236238
retryable: false,
@@ -283,7 +285,9 @@ fn diagnose_k3s_dns_proxy_failure(gateway_name: &str) -> GatewayFailureDiagnosis
283285
RecoveryStep::with_command("Prune Docker networks", "docker network prune -f"),
284286
RecoveryStep::with_command(
285287
"Destroy and recreate the gateway",
286-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
288+
format!(
289+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
290+
),
287291
),
288292
],
289293
retryable: true,
@@ -342,7 +346,9 @@ fn diagnose_node_pressure(gateway_name: &str) -> GatewayFailureDiagnosis {
342346
RecoveryStep::new("Increase Docker resource allocation or free resources on the host"),
343347
RecoveryStep::with_command(
344348
"Destroy and recreate the gateway after freeing resources",
345-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
349+
format!(
350+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
351+
),
346352
),
347353
],
348354
retryable: false,
@@ -365,7 +371,9 @@ fn diagnose_missing_supervisor(gateway_name: &str) -> GatewayFailureDiagnosis {
365371
),
366372
RecoveryStep::with_command(
367373
"Destroy and recreate the gateway with the updated image",
368-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
374+
format!(
375+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
376+
),
369377
),
370378
RecoveryStep::new(
371379
"Or set OPENSHELL_CLUSTER_IMAGE to a cluster image version that includes \
@@ -384,7 +392,7 @@ fn diagnose_certificate_issue(gateway_name: &str) -> GatewayFailureDiagnosis {
384392
.to_string(),
385393
recovery_steps: vec![RecoveryStep::with_command(
386394
"Destroy and recreate the gateway to regenerate certificates",
387-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
395+
format!("openshell gateway destroy --name {gateway_name} && openshell gateway start"),
388396
)],
389397
retryable: false,
390398
}
@@ -443,7 +451,9 @@ pub fn generic_failure_diagnosis(gateway_name: &str) -> GatewayFailureDiagnosis
443451
recovery_steps: vec![
444452
RecoveryStep::with_command(
445453
"Try destroying and recreating the gateway",
446-
format!("openshell gateway destroy {gateway_name} && openshell gateway start"),
454+
format!(
455+
"openshell gateway destroy --name {gateway_name} && openshell gateway start"
456+
),
447457
),
448458
RecoveryStep::with_command(
449459
"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
@@ -298,7 +298,7 @@ where
298298
return Err(miette::miette!(
299299
"Gateway '{name}' already exists (container_running={}).\n\
300300
Use --recreate to destroy and redeploy, or destroy it first with:\n\n \
301-
openshell gateway destroy {name}",
301+
openshell gateway destroy --name {name}",
302302
existing.container_running,
303303
));
304304
}

crates/openshell-cli/src/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@ pub async fn sandbox_create(
19001900
eprintln!();
19011901
eprintln!(
19021902
" {} && {}",
1903-
format!("openshell gateway destroy {gateway_name}").cyan(),
1903+
format!("openshell gateway destroy --name {gateway_name}").cyan(),
19041904
"openshell gateway start".cyan(),
19051905
);
19061906
eprintln!();

0 commit comments

Comments
 (0)