Skip to content

Commit 8af61b7

Browse files
committed
feat: implement Phase 1 core commands - current, which, deactivate, and exit codes
- Add phpvm current command to display active PHP version - Add phpvm which [version] command to show PHP binary paths - Add phpvm deactivate command to temporarily disable phpvm - Add ls alias for list command - Implement specific exit codes (0-5, 127) for better scripting - Add exit code documentation to help output - Add PATH preservation for deactivate functionality - Expand test suite to 14 tests This release achieves nvm feature parity for Phase 1 core commands.
1 parent adcce1f commit 8af61b7

3 files changed

Lines changed: 679 additions & 80 deletions

File tree

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
# Release Notes
22

3+
## [v1.7.0](https://github.com/Thavarshan/phpvm/compare/v1.6.0...v1.7.0) - 2025-12-10
4+
5+
### Added
6+
7+
- **New `phpvm current` command:** Display the currently active PHP version. Returns the version string, "system", or "none" depending on state.
8+
- **New `phpvm which [version]` command:** Show the full path to the PHP binary for a given version. Supports all package managers (brew, apt, dnf, yum, pacman).
9+
- **New `phpvm deactivate` command:** Temporarily disable phpvm management and restore the original PATH. Useful for debugging or temporarily using system defaults.
10+
- **New `ls` alias for `list`:** Added `phpvm ls` as an alias for `phpvm list` for convenience.
11+
- **Specific exit codes:** Implemented consistent exit codes across all commands for better scripting support:
12+
- `0` - Success
13+
- `1` - General error
14+
- `2` - Invalid argument or usage error
15+
- `3` - Version not found (not available)
16+
- `4` - Version not installed locally
17+
- `5` - File or permission error
18+
- `127` - Unknown command
19+
- **Exit code documentation:** Added exit codes section to help output.
20+
- **PATH preservation:** `phpvm use` now stores the original PATH on first activation to enable proper deactivation.
21+
22+
### Changed
23+
24+
- **Enhanced help output:** Updated help text with new commands, examples, and exit code documentation.
25+
- **Improved error handling:** Key functions now return specific exit codes instead of generic error codes.
26+
27+
### Internal
28+
29+
- **Added exit code constants:** Defined `PHPVM_EXIT_*` constants for maintainability.
30+
- **New helper functions:**
31+
- `phpvm_store_original_path()` - Preserves PATH for deactivate functionality
32+
- `phpvm_current()` - Returns current PHP version
33+
- `phpvm_which()` - Resolves PHP binary paths
34+
- `phpvm_deactivate()` - Disables phpvm temporarily
35+
- **Expanded test suite:** Added tests for `phpvm_current`, `phpvm_which`, and `phpvm_deactivate` (now 14 tests total).
36+
337
## [v1.6.0](https://github.com/Thavarshan/phpvm/compare/v1.5.0...v1.6.0) - 2025-09-15
438

539
### Added

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ PHP 8.1.13
5050
- Post-install validation with helpful warnings for missing binaries.
5151
- Enhanced Homebrew integration with better link failure detection.
5252
- Informative, color-coded feedback with timestamps for logs.
53-
- Includes unit tests with BATS for automated testing.
53+
- Built-in self-tests for verifying functionality (`phpvm test`).
5454
- Helper functions for better maintainability and reduced code duplication.
5555

5656
## Installation

0 commit comments

Comments
 (0)