From 1d569573dacd7fc650fd4be0032e0a39c1b3cafe Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Sun, 10 Jan 2021 19:20:30 +0530 Subject: [PATCH 1/2] formatted brew completion --- clean_files.txt | 1 + completion/available/brew.completion.bash | 28 ++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/clean_files.txt b/clean_files.txt index fd051078..be42f2cd 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -57,6 +57,7 @@ plugins/available/xterm.plugin.bash # completions # +completion/available/brew.completion.bash completion/available/cargo.completion.bash completion/available/knife.completion.bash completion/available/packer.completion.bash diff --git a/completion/available/brew.completion.bash b/completion/available/brew.completion.bash index 4bdaf53d..39d58841 100644 --- a/completion/available/brew.completion.bash +++ b/completion/available/brew.completion.bash @@ -1,11 +1,13 @@ -#!/usr/bin/env bash +# shellcheck shell=bash +cite "about-completion" +about-completion "brew completion" # Load late to make sure `system` completion loads first # BASH_IT_LOAD_PRIORITY: 375 -if [[ "$(uname -s)" != 'Darwin' ]] ; then - _log_warning "unsupported operating system - only 'Darwin' is supported" - return 0 +if [[ "$(uname -s)" != 'Darwin' ]]; then + _log_warning "unsupported operating system - only 'Darwin' is supported" + return 0 fi # Make sure brew is installed @@ -13,15 +15,15 @@ _command_exists brew || return 0 BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)} -if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]] ; then - source "$BREW_PREFIX"/etc/bash_completion.d/brew +if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]]; then + source "$BREW_PREFIX"/etc/bash_completion.d/brew -elif [[ -r "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]] ; then - source "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh +elif [[ -r "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]]; then + source "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh -elif [[ -f "$BREW_PREFIX"/completions/bash/brew ]] ; then - # For the git-clone based installation, see here for more info: - # https://github.com/Bash-it/bash-it/issues/1458 - # https://docs.brew.sh/Shell-Completion - source "$BREW_PREFIX"/completions/bash/brew +elif [[ -f "$BREW_PREFIX"/completions/bash/brew ]]; then + # For the git-clone based installation, see here for more info: + # https://github.com/Bash-it/bash-it/issues/1458 + # https://docs.brew.sh/Shell-Completion + source "$BREW_PREFIX"/completions/bash/brew fi From 37a7fac128a8f16b7f750bf96ec5ef849383a013 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 22 Jan 2021 23:44:41 +0200 Subject: [PATCH 2/2] completion: brew: Add shellcheck ignore directives --- completion/available/brew.completion.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/completion/available/brew.completion.bash b/completion/available/brew.completion.bash index 39d58841..91c288de 100644 --- a/completion/available/brew.completion.bash +++ b/completion/available/brew.completion.bash @@ -16,14 +16,17 @@ _command_exists brew || return 0 BREW_PREFIX=${BREW_PREFIX:-$(brew --prefix)} if [[ -r "$BREW_PREFIX"/etc/bash_completion.d/brew ]]; then + # shellcheck disable=1090 source "$BREW_PREFIX"/etc/bash_completion.d/brew elif [[ -r "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]]; then + # shellcheck disable=1090 source "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh elif [[ -f "$BREW_PREFIX"/completions/bash/brew ]]; then # For the git-clone based installation, see here for more info: # https://github.com/Bash-it/bash-it/issues/1458 # https://docs.brew.sh/Shell-Completion + # shellcheck disable=1090 source "$BREW_PREFIX"/completions/bash/brew fi