aboutsummaryrefslogtreecommitdiffstats
path: root/src/_ecdsautil
blob: 5d0a6f3cc52db52fbd142f317b7d38eebfa48a09 (plain) (blame)
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
#compdef ecdsautil
# ------------------------------------------------------------------------------
# Description
# -----------
#
#  Completion script for ecdsaultils v0.4.0 (https://github.com/tcatm/ecdsautils)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
#  * Robinhuett <https://github.com/Robinhuett>
#
# ------------------------------------------------------------------------------

_ecdsautil_args() {
  case $words[1] in
    (sign)
      _arguments '1:somefile:_files'
      ;;
    (verify)
      _arguments '-s[signature]:secret:_files' '-p[publickey]:pubkey:_files'
'-n[signaturecount]:signaturecount:""' ':file:_files'
      ;;
  esac
}

_ecdsautil() {
  local -a commands

  commands=(
    "help:Show help"
    "generate-key:generate a new secret on stdout"
    "show-key:output public key of secret read from stdin"
    "sign:sign file"
    "verify:verify signature of file"
  )

  _arguments -C \
    '1:cmd:->cmds' \
    '*:: :->args' \

  case "$state" in
    (cmds)
      _describe -t commands 'commands' commands
      ;;
    (*)
      _ecdsautil_args
      ;;
  esac
}

_ecdsautil "$@"