Sha256: 727921ab9391a76877e7c76109c092947cc601f787d47b344e3c3662c7804735

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

#!/bin/bash

_canal_complete() {
  local cur prev

  COMPREPLY=()
  cur=${COMP_WORDS[COMP_CWORD]}
  prev=${COMP_WORDS[COMP_CWORD-1]}

  # Setup the base level (everything after "canal")
  if [ $COMP_CWORD -eq 1 ]; then
    COMPREPLY=( $(compgen \
                  -W "create environment help repo restart session setup start stop" \
                  -- $cur) )
    return 0
  fi

  # Setup the second level
  if [ $COMP_CWORD -eq 2 ]; then
    case "$prev" in
      start|stop|restart)
        COMPREPLY=( $(compgen \
                      -W "`canal list tunnels`" \
                      -- $cur) )
        ;;
      environment)
        COMPREPLY=( $(compgen \
                      -W "create help show" \
                      -- $cur) )
        ;;
      session)
        COMPREPLY=( $(compgen \
                      -W "help restart restore show stop" \
                      -- $cur) )
        ;;
      setup)
        COMPREPLY=( $(compgen \
                      -W "completion help wizard" \
                      -- $cur) )
        ;;
      # Everything else
      *)
        COMPREPLY=( $(compgen \
                      -W "`canal list commands $prev`" \
                      -- $cur) )
        ;;
    esac
    return 0
  fi

  return 0
}
complete -F _canal_complete canal

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
canals-0.8.3 assets/canals.sh
canals-0.8.2 assets/canals.sh
canals-0.8.1 assets/canals.sh
canals-0.8.0 assets/canals.sh