Skip to content

Commit d117ff6

Browse files
committed
fix tests for version
1 parent 4b77b82 commit d117ff6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

crates/rb-cli/src/bin/rb.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ fn build_version_info() -> String {
4242

4343
fn main() {
4444
// Handle version request with custom formatting before parsing
45-
if std::env::args().any(|arg| arg == "--version" || arg == "-V") {
45+
// Only handle version if it's a direct flag, not part of exec command
46+
let args: Vec<String> = std::env::args().collect();
47+
let is_version_request = args.len() == 2 && (args[1] == "--version" || args[1] == "-V");
48+
49+
if is_version_request {
4650
println!("{}", build_version_info());
4751
return;
4852
}

tests/commands/Help.Unit.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ Describe "Ruby Butler - Help System" {
3333
It "Shows version with --version flag" {
3434
$Output = & $Script:RbPath --version 2>&1
3535
$LASTEXITCODE | Should -Be 0
36-
$Output | Should -Match "rb \d+\.\d+\.\d+"
36+
($Output -join " ") | Should -Match "Ruby Butler v\d+\.\d+\.\d+"
3737
}
3838

3939
It "Shows version with -V flag" {
4040
$Output = & $Script:RbPath -V 2>&1
4141
$LASTEXITCODE | Should -Be 0
42-
$Output | Should -Match "rb \d+\.\d+\.\d+"
42+
($Output -join " ") | Should -Match "Ruby Butler v\d+\.\d+\.\d+"
4343
}
4444
}
4545
}

0 commit comments

Comments
 (0)