File: dupload.bash-completion

package info (click to toggle)
dupload 2.13.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: perl: 1,891; sh: 81; makefile: 80
file content (70 lines) | stat: -rw-r--r-- 1,286 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Debian dupload(1) completion
#
# Copyright © 2002 Roland Mas <lolando@debian.org>
# Copyright © 2009 Paul Evans <leonerd@leonerd.org.uk>
# Copyright © 2017-2023 Guillem Jover <guillem@debian.org>

_dupload()
{
  COMPREPLY=()

  local cur=${COMP_WORDS[COMP_CWORD]}
  local prev=${COMP_WORDS[COMP_CWORD-1]}
  local options=(
    -c --configfile
    -d --debug
    -f --force
    -k --keep
    --no
    --nostats
    --nomail
    --mta
    --mailonly
    --noarchive
    -p --print
    -q --quiet
    -t --to
    -V --Version
  )

  case $cur in
  -*)
    COMPREPLY=($(compgen -W "${options[*]}" -- "$cur"))
    return
    ;;
  esac

  case $prev in
  --no|--nomail|--noarchive|\
  -k|--keep|\
  -d|--debug|\
  -f|--force|\
  -p|--print|\
  -q|--quiet|\
  -V|--Version)
    return
    ;;
  --configfile|-c|--mta)
    COMPREPLY=($(compgen -G "$cur*"))
    compopt -o filenames
    ;;
  --to)
    declare -a nicknames
    nicknames=($(dupload -p | awk -F': ' '/nick name/ { print $2 }'))
    COMPREPLY=($(compgen -W "${nicknames[*]}" -- "$cur"))
    ;;
  *)
    COMPREPLY=($(
      compgen -G "${cur}*.changes"
      compgen -W "${options[*]}" -- "$cur"
    ))
    compopt -o filenames
    compopt -o plusdirs
    ;;
  esac

  return
}
complete -F _dupload dupload

# vi: filetype=bash