File: tremc.sh

package info (click to toggle)
tremc 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 660 kB
  • sloc: python: 4,793; sh: 23; makefile: 15
file content (34 lines) | stat: -rw-r--r-- 893 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# bash completion for tremc(1)           -*- shell-script -*-

_tremc () {
  local cur prev opts

  _get_comp_words_by_ref cur prev

  opts="-h --help -v --version -c --connect -s --ssl -f --config --create-config -n --netrc -d --debug -k --list-keys -l --list-actions -X --skip-version-check --permissive -p --profile -r --reverse-dns"

  if [[ ${cur} == -* ]] ; then
    COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  else
    case "${prev}" in
      -c|--connect)
        # no completion, wait for user input
        ;;
      -p|--profile)
        COMPREPLY=($(  cat ~/.config/tremc/settings.cfg | grep ^profile"$cur" | cut -d' ' -f 1 | sed s/^profile// ))
        ;;
      -f|--config)
        # dirs and files
        _filedir
        ;;
      *)
        # dirs and torrents
        _filedir torrent
        ;;
    esac
  fi
}

complete -F _tremc tremc

# ex: ts=4 sw=4 et filetype=sh