Skip to content

Add nbox profile remove; fix the profile-add setup hint - #66

Merged
lance0 merged 1 commit into
masterfrom
fix/profile-add-hint-and-remove
Jun 23, 2026
Merged

lance0 merged 1 commit into
masterfrom
fix/profile-add-hint-and-remove

Conversation

@lance0

@lance0 lance0 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

What

Two small CLI fixes that came out of a first-run report (a stray duplicate profile + a bad setup hint).

nbox profile remove <name> (new)

Deletes a profile from the config, format-preserving (reuses the existing config::remove_profile toml_edit helper that the TUI already uses). Guards mirror the TUI's delete behavior:

  • active profile → refused (switch with \nbox profile use ` first`)
  • only profile → refused (won't strand the config)
  • unknown name → no profile named '<name>'

This gives a shell one-liner to drop a profile the first-run onboarding wizard leaves behind. The wizard always names its profile default (onboarding.rs), so a user who onboards in the TUI and then profile adds a real profile ends up with a duplicate default they previously had to hand-edit out.

Fix the --no-tui setup hint

no_tui_onboarding_refusal() printed:

nbox profile add <name> --url <url> [--token-env <VAR>]

--url doesn't exist — the URL is a positional argument (cli.rs), so copy-pasting the hint errored with unexpected argument '--url'. Every user-facing doc (README, CONFIG, TROUBLESHOOTING, SCRIPTING) already used the correct positional form; only this in-code hint was wrong. Now:

nbox profile add <name> <url> [--token-env <VAR>]

Tests

  • profile_remove_drops_a_non_active_profile
  • profile_remove_refuses_missing_active_and_only
  • Smoke-tested on the real binary: remove a stray non-active profile succeeds; active / only / missing are all refused.

Gate

cargo fmt --check, clippy --all-targets --all-features -D warnings, clippy --no-default-features, and cargo test in both feature modes — all green.

Add `nbox profile remove <name>`, which deletes a profile from the config
(format-preserving). It refuses to remove the active profile (switch with
`nbox profile use <other>` first) or the only profile, mirroring the TUI's
delete guards — so a stray profile (e.g. one left by the first-run onboarding
wizard) can be dropped without hand-editing the file.

Also fix the `--no-tui` first-run setup hint, which printed the wrong
`profile add` syntax (`--url <url>`); the URL is a positional argument. The
hint now matches the CLI and every user-facing doc.
@lance0
lance0 merged commit 3a28132 into master Jun 23, 2026
4 checks passed
@lance0
lance0 deleted the fix/profile-add-hint-and-remove branch June 23, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant