Sha256: 6780a60206354d6e3b09f454e3d9a390ba17f9e6224fb4d92f25074d183a5e43

Contents?: true

Size: 1.19 KB

Versions: 7

Compression:

Stored size: 1.19 KB

Contents

#!/bin/zsh

# grunt-cli
# http://gruntjs.com/
#
# Copyright (c) 2012 Tyler Kellen, contributors
# Licensed under the MIT license.
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT

# Usage:
#
# To enable zsh <tab> completion for grunt, add the following line (minus the
# leading #, which is the zsh comment character) to your ~/.zshrc file:
#
# eval "$(grunt --completion=zsh)"

# Enable zsh autocompletion.
function _grunt_completion() {
  local completions
  # The currently-being-completed word.
  local cur="${words[@]}"
  # The current grunt version, available tasks, options, etc.
  local gruntinfo="$(grunt --version --verbose 2>/dev/null)"
  # Options and tasks.
  local opts="$(echo "$gruntinfo" | awk '/Available options: / {$1=$2=""; print $0}')"
  local compls="$(echo "$gruntinfo" | awk '/Available tasks: / {$1=$2=""; print $0}')"
  # Only add -- or - options if the user has started typing -
  [[ "$cur" == -* ]] && compls="$compls $opts"
  # Trim whitespace.
  compls=$(echo "$compls" | sed -e 's/^ *//g' -e 's/ *$//g')
  # Turn compls into an array to of completions.
  completions=(${=compls})
  # Tell complete what stuff to show.
  compadd -- $completions
}

compdef _grunt_completion grunt

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
entangled-0.0.16 spec/dummy/public/node_modules/grunt-cli/completion/zsh
entangled-0.0.15 spec/dummy/public/node_modules/grunt-cli/completion/zsh
entangled-0.0.14 spec/dummy/public/node_modules/grunt-cli/completion/zsh
entangled-0.0.13 spec/dummy/public/node_modules/grunt-cli/completion/zsh
entangled-0.0.12 spec/dummy/public/node_modules/grunt-cli/completion/zsh
entangled-0.0.11 spec/dummy/public/node_modules/grunt-cli/completion/zsh
entangled-0.0.10 spec/dummy/public/node_modules/grunt-cli/completion/zsh