All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.home.bash.complete Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
stageList() {
  local base=${{stool.home}}/backstages
  for dir in $(ls -1 $base); do
    ls=$(ls -ld "$base/$dir")
    dir=$(expr "$ls" : '.*-> \(.*\)$')
    echo $(stageName $dir)
  done
  echo none
}
_stool_complete() {
      local cur prev cmd
      local select_opts general_opts
      COMPREPLY=()
      cur="${COMP_WORDS[COMP_CWORD]}"
      prev="${COMP_WORDS[COMP_CWORD-1]}"
      cmd="stop remove chown build setup validate version help system-start config import system-stop refresh move restart status select list create history start cd"
      general_opts="-v -e"
      select_opts="-stage -all"
      fail_opts="before after never"

      case "${prev}" in
        create)
            if [[ ${cur} == -* ]] ; then
                local option="-quiet -prefix -name "
                COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
                return 0
            fi
            # url
            return 0
            ;;
        import)
            if [[ ${cur} == -* ]] ; then
                local option="-max"
                COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
                return 0
            else
                COMPREPLY=( $(compgen -f "$2" ) )
                return 0
            fi
            ;;
        select)
            local stages=$(stageList)
            COMPREPLY=( $(compgen -W "${stages}" -- ${cur}) )
            return 0
            ;;
        status)
            local stages=$(stageList)
            COMPREPLY=( $(compgen -W "${stages}" -- ${cur}) )
            return 0
            ;;
        stop)
            if [[ ${cur} == -* ]] ; then
                local option="-sleep -stail"
                COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
            fi
            ;;
        config)
            compopt +o nospace &>/dev/null
            local option="suffix expire maven.opts java.home tomcat.select tomcat.perm tomcat.heap tomcat.version tomcat.opts port.prefix build cookies pustefix.mode autoRefresh comment fitnesse logstash"
            COMPREPLY=( $(compgen -o nospace -W "${option}" -- ${cur}) )
            return 0
            ;;
        restart)
            if [[ ${cur} == -* ]] ; then
                local option="-debug"
                COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
            fi
            ;;
        chown)
            COMPREPLY=( $(compgen -W "$USER" -- ${cur}) )
            return 0
            ;;
        remove)
            if [[ ${cur} == -* ]] ; then
                local option="-force -batch"
                COMPREPLY=( $(compgen -W "${option}" -- ${cur}) )
                return 0
            fi
            ;;
           cd)
            local stages="backstage conf java jmx run tomcat conf logs temp work  "
            COMPREPLY=( $(compgen -W "${stages}" -- ${cur}) )
            return 0
            ;;
        *)
            ;;
      esac

      COMPREPLY=( $(compgen -W "${cmd}" -- ${cur}) )
      return 0
}

complete -F _stool_complete stool




© 2015 - 2024 Weber Informatics LLC | Privacy Policy