Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Homebrew/mas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def install
"-configuration", "Release",
"SYMROOT=build"
bin.install "build/mas"

bash_completion.install "contrib/completion/mas-completion.bash" => "mas"
end

test do
Expand Down
18 changes: 18 additions & 0 deletions contrib/completion/mas-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

_mas()
{
local cur prev words cword;
if declare -F _init_completions >/dev/null 2>&1; then
_init_completion
else
COMPREPLY=()
_get_comp_words_by_ref cur prev words cword
fi
if [[ $cword -eq 1 ]]; then
COMPREPLY=($( compgen -W "$(mas help | tail +3 | awk '{print $1}')" -- "$cur" ));
return 0
fi
}

complete -F _mas mas