Skip to content

feat(cli): Add context create/delete CLI commands to complete login/logout workflow#2998

Open
atharvalade wants to merge 2 commits intoapache:masterfrom
atharvalade:feat/cli-login-logout
Open

feat(cli): Add context create/delete CLI commands to complete login/logout workflow#2998
atharvalade wants to merge 2 commits intoapache:masterfrom
atharvalade:feat/cli-login-logout

Conversation

@atharvalade
Copy link
Contributor

Which issue does this PR close?

Closes #595

Rationale

The login/logout commands and context infrastructure (list, use) already existed, but users had to manually edit ~/.iggy/contexts.toml to create or remove contexts. This PR adds the missing context create and context delete subcommands so the entire credential workflow can be managed entirely through the CLI, similar to docker login/docker logout + docker context.

What changed?

Users could not create or delete contexts via the CLI — they had to manually edit TOML files. This made the docker-login-like workflow incomplete.

Added iggy context create <name> [--transport, --tcp-server-address, --username, ...] and iggy context delete <name> commands with proper validation (duplicate prevention, cannot delete default, active context reset on deletion), along with integration tests covering success paths, edge cases, and help text.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

  1. Opus 4.6
  2. Minimal AI used
  3. Verified by building, running all commands locally with edge cases, and running cargo fmt/clippy/license checks
  4. Yes
Screenshot 2026-03-20 at 2 08 46 PM Screenshot 2026-03-20 at 2 08 53 PM Screenshot 2026-03-20 at 2 09 01 PM Screenshot 2026-03-20 at 2 09 16 PM Screenshot 2026-03-20 at 2 09 22 PM Screenshot 2026-03-20 at 2 09 29 PM Screenshot 2026-03-20 at 2 09 49 PM Screenshot 2026-03-20 at 2 09 56 PM

@atharvalade atharvalade changed the title Add context create/delete CLI commands to complete login/logout workflow feat(cli): Add context create/delete CLI commands to complete login/logout workflow Mar 20, 2026
@hubcio
Copy link
Contributor

hubcio commented Mar 20, 2026

@BartoszCiesla perhaps you want to review? :)

@BartoszCiesla
Copy link
Contributor

@hubcio it would be good to cross check if options defined for context create match corresponding options in basic commands - from what I've checked this pull request contains only long versions and AFAIR at least some of the options had short versions (--password and -p). It would be best to reuse the descriptions - either by copying the existing clap content or following / re-using existing structs (if possible). Keeping the information consistent will make things much easier for the user. But that's just my view ;-)

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.

Add login / logout commands to iggy cli to reduce credentials related args / flags

3 participants