Skip to content

Remove empty alias for check-update

Kerri Miller requested to merge github/fork/carlpett/fix-update-empty-alias into trunk

Created by: carlpett

Description The check-update command has an empty alias, which breaks at least the bash-completion. Trying to use completion would look like this:

$ glab <tab>-bash: aliashash[""]: bad array subscript

This is because the empty alias causes this in the generated bash-completion:

_glab_root_command()
{
    last_command="glab"

    command_aliases=()

    commands=()
    commands+=("alias")
    commands+=("auth")
    commands+=("check-update")
    if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
        command_aliases+=("")        # <---
        aliashash[""]="check-update" # <---
        command_aliases+=("update")
        aliashash["update"]="check-update"
    fi

Related Issue #287 (closed)

Motivation and Context

How Has This Been Tested?

# With released version
$ glab completion -s bash > before.compl
# With PR build
$ ./glab completion -s bash > after.compl
# Only broken parts changed
$ diff before.compl after.compl
2546a2547,2548
>         command_aliases+=("")
>         aliashash[""]="check-update"
# Also, completion works
$ source after.compl
$ glab con<tab>
$ glab config

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Merge request reports