Skip to content

feat: per shell switching#2

Merged
Rijoanul-Shanto merged 8 commits into
mainfrom
feat/per-shell-switching
May 27, 2026
Merged

feat: per shell switching#2
Rijoanul-Shanto merged 8 commits into
mainfrom
feat/per-shell-switching

Conversation

@Rijoanul-Shanto

@Rijoanul-Shanto Rijoanul-Shanto commented May 27, 2026

Copy link
Copy Markdown
Collaborator

What

v2.5.0 > per-shell switching

  • phpvm shell pins PHP for the current terminal only via a php shim on PATH, no sudo, no effect on other shells
  • phpvm local writes .php-version (no sudo); phpvm global moves the update-alternatives symlink (sudo). --set / --set-project kept as aliases
  • Three-layer resolution: shell pin (PHPVM_SHELL_VERSION) > project (PHPVM_AUTO_VERSION from cd-hook) > global symlink
  • TUI pins the current shell on Enter when launched through the wrapper; g for global, p for project
  • phpvm --current reports all three layers plus the effective version - --doctor gains a per-shell switching section
  • Shell hooks (bash/zsh/fish) rewritten: shim prepended to PATH, phpvm() wrapper routes shell and bare TUI through eval/| source
  • install.sh installs the shim, enables the hook by default

Why

  • Per-shell switching is the standard model (rbenv, pyenv, asdf) and the most requested missing feature: two terminals on two versions at once, no sudo on every switch, and a shell pin that survives cd into a project with a different .php-version

Tested

  • bash phpvm.sh runs without errors
  • shellcheck phpvm.sh passes (CI gate at -S warning)
  • 33/33 tests pass in tests/test_cli.sh, including new coverage for --current three-layer output, local version normalization (php8.1 and 8.2.0), and shim fallback/pin behaviour
  • CI matrix (Ubuntu 20.04 / 22.04 / 24.04) all 7 jobs green
  • phpvm install tested in a clean Docker container; debconf hang confirmed fixed with DEBIAN_FRONTEND=noninteractive
  • TUI wrapper mode tested with tmux pty-driving in a container (Enter pins shell, g switches global, q quits)
  • Tested on Bash version: 5.1.16 (Ubuntu 22.04)

… switching

- Replace `--set` with `global` and `--set-project` with `local` for clarity.
- Add support for `phpvm shell` command for per-shell version switching without sudo.
- Introduce shims for project and shell-specific PHP resolution.
- Update interactive TUI and installation scripts to support the new workflow.
- Improve documentation for updated commands and features.
…ation and landing pages

- Replace "PHP version switcher" with "PHP version manager" in all descriptions for alignment with feature scope.
- Update meta tags, titles, and descriptions in HTML files for improved clarity and SEO.
- Adjust TUI and shell workflow descriptions for accuracy and consistency.
- Improve phrasing across website, README, and contributor guide.
…him` fallback scenarios

- Add tests for `--current` to verify three-layer breakdown (shell/project/global).
- Include version normalization tests for `local` commands (e.g., `php8.1` to `8.1`).
- Add shim script tests for fallback behavior and version-specific execution.
- Standardize "Motivation" wording in PR template.
- Expand shellcheck command to include multiple scripts for stricter linting.
- Add new CLI test script to testing checklist.
@Rijoanul-Shanto Rijoanul-Shanto merged commit d712b95 into main May 27, 2026
7 checks passed
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