Skip to content

Add a option to disable update notifications #743

Closed

Description

@remi-dupre

Describe the feature or problem you’d like to solve

When running the completion sub-command, gh cli will check for updates and write a message if an update is available (this was suggested in #85). The expected use is to eval this command in your .bashrc or .anything_rc, this means that a information message will be written every time a prompt is opened.

While I think this feature is useful (this tool is not part of most distributions official repositories yet), I also think that it can be considered to be quite annoying and intrusive. If you installed this from a repository, this also means that you might get pointless messages for a few days until your package gets updated, this might become a very common scenario in the future.

Proposed solution

It would be nice to have a feature switch in parameters (-q, --quiet for example?) to disable update notifications. Currently no such option seem to exist:

>> gh completion -h
Generate shell completion scripts for GitHub CLI commands.

For example, for bash you could add this to your '~/.bash_profile':

	eval "$(gh completion)"

When installing GitHub CLI through a package manager, however, it's possible that
no additional shell configuration is necessary to gain completion support. For
Homebrew, see <https://docs.brew.sh/Shell-Completion>

Usage:
  gh completion [flags]

Flags:
  -s, --shell string   Shell type: {bash|zsh|fish|powershell} (default "bash")

Global Flags:
      --help              Show help for command
  -R, --repo OWNER/REPO   Select another repository using the OWNER/REPO format

Activity

  1. changed the title [-]Add a option to hide update notifications[/-] [+]Add a option to disable update notifications[/+] on Apr 3, 2020
  2. mislav commented on Apr 3, 2020

    @mislav
    Contributor

    Thank you for a great feature request!

    It's a good point that upgrade check + notifications definitely should not run during gh completion for the reason you stated. I will open a separate issue labeled "bug" for that.

    I also agree that there should be a documented way to disable upgrade notifications. 👍

  3. mike-burns commented on Oct 6, 2020

    @mike-burns

    Back in #99 (review) @mislav suggested

    there should be an env flag to disable automatic upgrade lookup

    Is that idea still on the table?

  4. mislav commented on Oct 7, 2020

    @mislav
    Contributor

    @mike-burns Yes the idea is still on the table!

    I propose: GH_NO_UPDATE_NOTIFIER=1 (or any value) disables checking for updates.

    @samcoe I don't think we need to add a config file setting for this just yet. Let's see if people ask for it after they already have the environment setting.

    Furthermore, I believe that we shouldn't check for updates in CI/CD environments at all. We can detect these environments by checking if any of these environment variables is set to a non-blank value: CI, BUILD_NUMBER, RUN_ID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions