From dd220152be26163c93ed1c0f9f98e7bad0653941 Mon Sep 17 00:00:00 2001 From: Dimitri Jorge Date: Sun, 1 Sep 2013 18:20:08 +0200 Subject: [PATCH 1/2] Add autocompletion plugin for meteor command --- plugins/meteor/_meteor | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 plugins/meteor/_meteor diff --git a/plugins/meteor/_meteor b/plugins/meteor/_meteor new file mode 100644 index 000000000..c90ed6caf --- /dev/null +++ b/plugins/meteor/_meteor @@ -0,0 +1,32 @@ +#compdef meteor +#autoload + +# Meteor Autocomplete plugin for Oh-My-Zsh, based on homebrew completion +# Original author: Dimitri JORGE (https://github.com/jorge-d) + +local -a _1st_arguments +_1st_arguments=( + 'run:[Default] Run this project in local development mode' + 'create:Create a new project' + 'update:Upgrade this project to the latest version of Meteor' + 'add:Add a package to this project' + 'remove:Remove a package from this project' + 'list:List available packages' + 'help:Display Meteor help' + 'bundle:Pack this project up into a tarball' + 'mongo:Connect to the Mongo database for the specified site' + 'deploy:Deploy this project to Meteor' + 'logs:Show logs for specified site' + 'reset:Reset the project state. Erases the local database.' + 'test-packages:Test one or more packages' +) + +if (( CURRENT == 2 )); then + _describe -t commands "meteor subcommand" _1st_arguments + return +fi + +case "$words[2]" in + help) + _describe -t commands "brew subcommand" _1st_arguments +esac \ No newline at end of file From 90b83b81017bbf55d5c10e6bced835f6d184499d Mon Sep 17 00:00:00 2001 From: Dimitri Jorge Date: Sun, 1 Sep 2013 19:23:21 +0200 Subject: [PATCH 2/2] Add completion for package add and remove --- plugins/meteor/_meteor | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/meteor/_meteor b/plugins/meteor/_meteor index c90ed6caf..cd7fc304f 100644 --- a/plugins/meteor/_meteor +++ b/plugins/meteor/_meteor @@ -4,6 +4,13 @@ # Meteor Autocomplete plugin for Oh-My-Zsh, based on homebrew completion # Original author: Dimitri JORGE (https://github.com/jorge-d) +_meteor_all_packages() { + packages=(`meteor list | cut -d" " -f1`) +} +_meteor_installed_packages() { + installed_packages=(`meteor list --using`) +} + local -a _1st_arguments _1st_arguments=( 'run:[Default] Run this project in local development mode' @@ -21,6 +28,9 @@ _1st_arguments=( 'test-packages:Test one or more packages' ) +local expl +local -a packages installed_packages + if (( CURRENT == 2 )); then _describe -t commands "meteor subcommand" _1st_arguments return @@ -28,5 +38,11 @@ fi case "$words[2]" in help) - _describe -t commands "brew subcommand" _1st_arguments + _describe -t commands "meteor subcommand" _1st_arguments ;; + remove) + _meteor_installed_packages + _wanted installed_packages expl 'installed packages' compadd -a installed_packages ;; + add) + _meteor_all_packages + _wanted packages expl 'all packages' compadd -a packages ;; esac \ No newline at end of file