GHC 2019-02-14

1 comment.

, https://git.io/fh7S2 in Homebrew/brew
--quiet conflicts with HOMEBREW_VERBOSE for brew-outdated
=========================================================

I have `HOMEBREW_VERBOSE` set for many years, and it never conflicted with the `--quiet` flag on the command line. When `--quiet` is specified, it simply overrides `HOMEBREW_VERBOSE`, as is the convention for handling option vs environment variable in most *nix tools.

However, a few weeks ago, 867b155479be4a50e02580e05df770aec84438be (CC author @MikeMcQuaid) broke this. Now, using `--quiet` with `brew outdated` when `HOMEBREW_VERBOSE` is set simply results in an error saying `--quiet` and `--verbose` are mutually exclusive. (This broke my auto update script.) The problem apparently stems from making no distinction between `HOMEBREW_VERBOSE` and the `--verbose` option on the command line.

The point is: *command line option should override a conflicting env var when necessary, instead of being treated as a conflicting equal.*

# What you were trying to do (and why)

```console
$ HOMEBREW_VERBOSE=1 brew outdated --quiet
```

Why? Because I have `HOMEBREW_VERBOSE` set globally, and only override it on the command line as I see fit.

# What happened

```console
$ HOMEBREW_VERBOSE=1 brew outdated --quiet
Error: Options --quiet and --verbose are mutually exclusive.
```

# What you expected to happen

No error.

P.S. The help text doesn't help.

```console
$ brew outdated -h
Usage: brew outdated [options]

Show formulae that have an updated version available.

By default, version information is displayed in interactive shells, and
suppressed otherwise.

    -q, --quiet                      List only the names of outdated brews
                                     (takes precedence over --verbose).
```

Note *takes precedence over*.