Skip to content

feat(venv): add prefix flag to customize prompt project name - #14

Merged
benbenbang merged 1 commit into
mainfrom
refactor/uv_shell
Mar 26, 2026
Merged

benbenbang merged 1 commit into
mainfrom
refactor/uv_shell

Conversation

@benbenbang

Copy link
Copy Markdown
Owner

This pull request adds a new --prefix flag that allows users to override the project name portion of the virtual environment prompt while keeping the automatic Python version suffix. The most important changes are grouped below.

New prefix flag functionality:

  • Added a new --prefix parameter to the update_prompt function in src/main.rs that allows overriding the project name used in the prompt, while still automatically appending the Python version suffix (e.g., -pyX.XX).
  • Updated the scan_flags function to parse and return the --prefix flag value, supporting both --prefix value and --prefix=value syntax.
  • Modified the prompt generation logic to use the provided prefix if available, otherwise falling back to the current directory name as before.

Documentation and help text updates:

  • Updated the help text to clarify the difference between --prefix (overrides project name, keeps -pyX.XX suffix) and --prompt (replaces the entire auto-generated prompt).

Testing improvements:

  • Added new test cases scan_flags_prefix_space and scan_flags_prefix_eq to verify correct parsing of the --prefix flag in both supported formats.
  • Updated all existing scan_flags test cases to handle the new fourth return value (prefix).

This pull request adds a new `--prefix` flag that allows users to override the project name portion of the virtual environment prompt while keeping the automatic Python version suffix. The most important changes are grouped below.

**New prefix flag functionality:**
* Added a new `--prefix` parameter to the `update_prompt` function in `src/main.rs` that allows overriding the project name used in the prompt, while still automatically appending the Python version suffix (e.g., `-pyX.XX`).
* Updated the `scan_flags` function to parse and return the `--prefix` flag value, supporting both `--prefix value` and `--prefix=value` syntax.
* Modified the prompt generation logic to use the provided prefix if available, otherwise falling back to the current directory name as before.

**Documentation and help text updates:**
* Updated the help text to clarify the difference between `--prefix` (overrides project name, keeps `-pyX.XX` suffix) and `--prompt` (replaces the entire auto-generated prompt).

**Testing improvements:**
* Added new test cases `scan_flags_prefix_space` and `scan_flags_prefix_eq` to verify correct parsing of the `--prefix` flag in both supported formats.
* Updated all existing `scan_flags` test cases to handle the new fourth return value (prefix).
@benbenbang
benbenbang enabled auto-merge (squash) March 26, 2026 17:13
@github-actions github-actions Bot added enhancement New feature or request triage labels Mar 26, 2026
@benbenbang
benbenbang merged commit 30f604c into main Mar 26, 2026
2 checks passed
@benbenbang
benbenbang deleted the refactor/uv_shell branch March 26, 2026 17:14
@ptah-technical-app

Copy link
Copy Markdown

🎉 This PR is included in version 2.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@ptah-technical-app

Copy link
Copy Markdown

🎉 This PR is included in version 2.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant