Skip to content

(cli): context use can fail on fresh system when ~/.iggy/ directory does not exist #3030

@atharvalade

Description

@atharvalade

The context use command writes to ~/.iggy/.active_context via tokio::fs::write, which fails if the ~/.iggy/ directory hasn't been created yet.

The recently added context create command handles this by calling ensure_iggy_home_exists() before writing, but the existing write_active_context() and write_contexts() methods in ContextReaderWriter don't do this.

Steps to reproduce:

  1. Remove ~/.iggy/ if it exists
  2. Run iggy context use default
  3. Observe a write error because the directory is missing

Fix would be to call ensure_iggy_home_exists() inside write_active_context() and write_contexts() so all write paths handle a fresh system.

Please wait before #2998 merges to work on this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions