From e71deef7a801d8fdb63bc88b668e6521700a093d Mon Sep 17 00:00:00 2001 From: Alexander Fomin Date: Tue, 29 Jan 2019 22:20:16 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=BA=20Add=20completions=20for=20fish?= =?UTF-8?q?=20shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Homebrew/mas-tap.rb | 1 + Homebrew/mas.rb | 1 + contrib/completion/mas.fish | 45 +++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 contrib/completion/mas.fish diff --git a/Homebrew/mas-tap.rb b/Homebrew/mas-tap.rb index 70f5320..d2e526e 100644 --- a/Homebrew/mas-tap.rb +++ b/Homebrew/mas-tap.rb @@ -33,6 +33,7 @@ class Mas < Formula system "script/install", prefix bash_completion.install "contrib/completion/mas-completion.bash" => "mas" + fish_completion.install "contrib/completion/mas.fish" end test do diff --git a/Homebrew/mas.rb b/Homebrew/mas.rb index 457ec67..7ee6876 100644 --- a/Homebrew/mas.rb +++ b/Homebrew/mas.rb @@ -30,6 +30,7 @@ class Mas < Formula system "script/install", prefix bash_completion.install "contrib/completion/mas-completion.bash" => "mas" + fish_completion.install "contrib/completion/mas.fish" end test do diff --git a/contrib/completion/mas.fish b/contrib/completion/mas.fish new file mode 100644 index 0000000..86537aa --- /dev/null +++ b/contrib/completion/mas.fish @@ -0,0 +1,45 @@ +# fish completions for mas + +### account +complete -c mas -n "__fish_use_subcommand" -f -a account -d "Prints the primary account Apple ID" +### help +complete -c mas -n "__fish_use_subcommand" -f -a help -d "Display general or command-specific help" +### home +complete -c mas -n "__fish_use_subcommand" -f -a home -d "Opens MAS Preview app page in a browser" +### info +complete -c mas -n "__fish_use_subcommand" -f -a info -d "Display app information from the Mac App Store" +### install +complete -c mas -n "__fish_use_subcommand" -f -a install -d "Install from the Mac App Store" +complete -c mas -n "__fish_seen_subcommand_from install" -l force -d "Force reinstall" +### list +complete -c mas -n "__fish_use_subcommand" -f -a list -d "Lists apps from the Mac App Store which are currently installed" +### lucky +complete -c mas -n "__fish_use_subcommand" -f -a lucky -d "Install the first result from the Mac App Store" +### open +complete -c mas -n "__fish_use_subcommand" -f -a open -d "Opens app page in AppStore.app" +### outdated +complete -c mas -n "__fish_use_subcommand" -f -a outdated -d "Lists pending updates from the Mac App Store" +### reset +complete -c mas -n "__fish_use_subcommand" -f -a reset -d "Resets the Mac App Store" +complete -c mas -n "__fish_seen_subcommand_from reset" -l debug -d "Enable debug mode" +### search +complete -c mas -n "__fish_use_subcommand" -f -a search -d "Search for apps from the Mac App Store" +complete -c mas -n "__fish_seen_subcommand_from search" -l price -d "Show price of found apps" +### signin +complete -c mas -n "__fish_use_subcommand" -f -a signin -d "Sign in to the Mac App Store" +complete -c mas -n "__fish_seen_subcommand_from signin" -l price -d "Complete login with graphical dialog" +### signout +complete -c mas -n "__fish_use_subcommand" -f -a signout -d "Sign out of the Mac App Store" +### uninstall +complete -c mas -n "__fish_use_subcommand" -f -a uninstall -d "Uninstall app installed from the Mac App Store" +complete -c mas -n "__fish_seen_subcommand_from uninstall" -l dry-run -d "Dry run mode" +for line in (command mas list 2>/dev/null) + set app (string split " " -- $line) + complete -c mas -n "__fish_seen_subcommand_from uninstall" -f -a $app[1] -d $app[2] +end +### upgrade +complete -c mas -n "__fish_use_subcommand" -f -a upgrade -d "Upgrade outdated apps from the Mac App Store" +### vendor +complete -c mas -n "__fish_use_subcommand" -f -a vendor -d "Opens vendor's app page in a browser" +### version +complete -c mas -n "__fish_use_subcommand" -f -a version -d "Print version number"