Repository: flutter
Issue: flutter_tools: Command logging is not muted in verbose mode when a top-level flag is used before the doctor or help commands
Labels: tool,has reproducible steps,P2,found in release: 3.7,found in release: 3.10,team-tool,triaged-tool

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Run a verbose `help` or `doctor` command with a top-level flag before the command (e.g. `flutter --no-version-check doctor -v`)

### Actual results

Command logging is enabled, even though `-v` and not `-vv` is given.

This is caused by [faulty logic where the command is identified](https://github.com/flutter/flutter/blob/be45eb2420b297a670b43d7da3ed03c2838ed6e7/packages/flutter_tools/lib/executable.dart#L72).

The `help` or `doctor` command is identified only in one of a few specific situations:

- The first argument is `help` or `doctor`
- A single `-v` is provided as the first argument, followed by `help` or `doctor`

This does not catch the situation where another flag is provided as the first argument. The `help` or `doctor` command should not be assumed to be in the last position, and the number of flags in use should be irrelevant.

### Logs

<details>
<summary>Logs</summary>

The logs may contain sensitive information.
The output is identical to the result of `flutter doctor -vv`.

</details>


### Flutter Doctor output

<details>
<summary>Doctor output</summary>

```console

[✓] Flutter (Channel stable, 3.7.11, on NixOS 23.05 (Stoat) 6.2.9-zen1, locale en_AU.utf8)
    • Flutter version 3.7.11 on channel stable at /nix/store/0sd6wr3v45iy3xjzgdwafzd5d7l7hjfg-flutter-3.7.11-unwrapped
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f72efea43c (2 days ago), 2023-04-11 11:57:21 -0700
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /nix/store/z206lgjqbmj2aj2xib6rl8s29arc58x5-android-sdk-env/share/android-sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /nix/store/z206lgjqbmj2aj2xib6rl8s29arc58x5-android-sdk-env/share/android-sdk
    • ANDROID_SDK_ROOT = /nix/store/z206lgjqbmj2aj2xib6rl8s29arc58x5-android-sdk-env/share/android-sdk
    • Java binary at: /home/josh/SDKs/Java/17/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+10-nixos)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /nix/store/z647j0djsicc7lpfn2nk18dmmd9kdpsy-chromium-112.0.5615.49/bin/chromium

[✓] Linux toolchain - develop for Linux desktop
    • clang version 11.1.0
    • cmake version 3.25.3
    • ninja version 1.11.1
    • pkg-config version 0.29.2


[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • NixOS 23.05 (Stoat) 6.2.9-zen1
    • Chrome (web)    • chrome • web-javascript • Chromium 112.0.5615.49

[✓] HTTP Host Availability
    • All required HTTP hosts are available

```

</details>