Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

brew.sh: fix brew -v #17903

Merged
merged 1 commit into from
Jul 30, 2024
Merged

brew.sh: fix brew -v #17903

merged 1 commit into from
Jul 30, 2024

Conversation

carlocab
Copy link
Member

@carlocab carlocab commented Jul 30, 2024

brew -v was previously equivalent to brew --version, but it
currently returns the output of brew help. (This also occurs with
brew -x, where x is any single character.)

This is because the -? pattern matches - followed by any single
character. We need to quote it to capture the intended meaning.


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

`brew -v` was previously equivalent to `brew --version`, but it
currently returns the output of `brew help`. (This also occurs with
`brew -x`, where x is any single character.)

This is because the `-?` pattern matches `-` followed by any single
character. We need to quote it to capture the intended meaning.
@carlocab carlocab enabled auto-merge July 30, 2024 09:36
@carlocab carlocab merged commit 3ac3fee into master Jul 30, 2024
24 checks passed
@carlocab carlocab deleted the fix-dash-v branch July 30, 2024 10:12
@MikeMcQuaid
Copy link
Member

Good catch here, thanks @carlocab!

enescakir added a commit to enescakir/runner-images that referenced this pull request Jul 30, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew --version"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
enescakir added a commit to enescakir/runner-images that referenced this pull request Jul 30, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
ijunaidm pushed a commit to actions/runner-images that referenced this pull request Jul 30, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
enescakir added a commit to ubicloud/runner-images that referenced this pull request Jul 31, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
sarathrajsrinivasan pushed a commit to sarathrajsrinivasan/runner-images that referenced this pull request Jul 31, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
nikolai-in pushed a commit to nikolai-in/proxmox-runner-images that referenced this pull request Aug 1, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
enescakir added a commit to ubicloud/runner-images that referenced this pull request Aug 5, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
Water-Melon pushed a commit to Kong/runner-images-kvm that referenced this pull request Sep 25, 2024
`Tools.Tests.ps1` checks the version of `brew` with `--version` argument.

```powershell
    Describe "Homebrew" {
    It "homebrew" {
        "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode
    }
}
```

`SoftwareReport.Common.psm1` checks it with `-v` argument.

```powershell
    function Get-HomebrewVersion {
        $result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew -v"
        $result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
        return $Matches.version
    }
```

Generally, `--version` and `-v` are equivalent. But a recent bug in `brew` makes `-v` returns the output of `brew help`.

Homebrew/brew#17903

It's best to maintain consistency in version checks and explicitly use `--version` in both places.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants