Bash completion for JS command
authorFrederic Massart <fred@moodle.com>
Mon, 12 May 2014 03:48:04 +0000 (11:48 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 12 May 2014 03:48:04 +0000 (11:48 +0800)
extra/bash_completion

index a78b3b1..558be82 100644 (file)
@@ -49,7 +49,7 @@ function _mdk() {
     if [[ "${COMP_CWORD}" == 1 ]]; then
         # List the commands and aliases.
         # Ignoring these commands on purpose: init
-        OPTS="alias backport backup behat config create css doctor fix info install phpunit plugin purge pull push rebase remove run tracker uninstall update upgrade"
+        OPTS="alias backport backup behat config create css doctor fix info install js phpunit plugin purge pull push rebase remove run tracker uninstall update upgrade"
         OPTS="$OPTS $($BIN alias list 2> /dev/null | cut -d ':' -f 1)"
     else
         # List of options according to the command.
@@ -141,6 +141,19 @@ function _mdk() {
                     ;;
                 esac
                 ;;
+            js)
+                OPTS="--plugin --module"
+                case "$PREV" in
+                    js)
+                        OPTS="shift"
+                        ;;
+                    *)
+                        if [[ "$CUR" != -* ]]; then
+                            OPTS="$OPTS $(_list_instances)"
+                        fi
+                        ;;
+                esac
+                ;;
             plugin)
                 if [[ "${COMP_CWORD}" == 2 ]]; then
                     OPTS="download install"