From f2dce55aae2f8278a8fbf0740b905d7e9298ae9f Mon Sep 17 00:00:00 2001 From: Lawrence Date: Sat, 8 Jun 2019 17:59:46 -0400 Subject: [PATCH] Add only unpinned formulae as completions for `brew pin` --- completions/fish/brew.fish | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 19b3accfc6..5e30aa3426 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -112,6 +112,11 @@ function __fish_brew_suggest_formulae_pinned | string replace -r '\s' '\t' end +function __fish_brew_suggest_formulae_unpinned + # set difference of: all - pinned + join -v2 (brew list --pinned | psub) (brew list | psub) +end + function __fish_brew_suggest_formulae_multiple_versions -d "List of installed formulae with their multiple versions" # NOTE: this assumes having `brew info --json=v1 --installed` cached # __fish_brew_ruby_parse_json 'installed.json' " @@ -465,9 +470,8 @@ __fish_brew_complete_arg 'outdated; and not __fish_brew_opt --quiet -v --verbose __fish_brew_complete_arg 'outdated' -l fetch-HEAD -d "Fetch the upstream repository to detect if the HEAD installation is outdated" -# TODO: should suggest only unpinned formulae and show their current versions in the description __fish_brew_complete_cmd 'pin' "Pin the specified formulae to their current versions" -__fish_brew_complete_arg 'pin' -a '(__fish_brew_suggest_formulae_installed)' +__fish_brew_complete_arg 'pin' -a '(__fish_brew_suggest_formulae_unpinned)' __fish_brew_complete_cmd 'postinstall' "Rerun the post-install steps for formula"