about summary refs log tree commit diff
path: root/Completion/Unix/Command/_asciinema
blob: 8e94f0d1e6ef2ad1aeaa007c4f4a8209284afb9e (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
54
55
56
57
58
59
#compdef asciinema

local ret=1
local -a context line state state_descr help
local -A opt_args

help=( '(: * -)'{-h,--help}'[display help information]' )

_arguments -A '-*' \
  $help \
  '(: * -)--version[display version information]' \
  '1:command:((
    auth\:"link install ID with asciinema.org account"
    cat\:"dump full output of recorded session"
    play\:"play back recorded session"
    rec\:"record session"
    upload\:"upload recorded session"
  ))' \
  '*:: :->next' \
&& ret=0

[[ $state == next ]] &&
case $words[1] in
  auth)
    _arguments -s -S : $help && ret=0
    ;;
  cat|upload)
    _arguments -s -S : $help '1::recording file:_files' && ret=0
    ;;
  play)
    _arguments -s -S : \
      $help \
      '(-i --idle-time-limit)'{-i+,--idle-time-limit=}'[specify max idle time]:max idle time (seconds)' \
      '(-s --speed)'{-s+,--speed=}'[specify playback speed]:speed factor' \
      '1: :->files-urls' \
    && ret=0
    [[ $state == files-urls ]] &&
    _alternative 'files:recording file:_files' 'urls: :_urls' &&
    ret=0
    ;;
  rec)
    _arguments -s -S : \
      $help \
      '(--overwrite)--append[append to existing recording]' \
      '(-c --command)'{-c+,--command=}'[specify command to record]: :_path_commands' \
      '(-e --env)'{-e+,--env=}'[specify environment variables to capture]:environment variable:_sequence _parameters -g "*export*"' \
      '(-i --idle-time-limit)'{-i+,--idle-time-limit=}'[specify max idle time]:max idle time (seconds)' \
      '(-q -y --quiet --yes)'{-q,--quiet}'[suppress notices/warnings (implies -y)]' \
      '--raw[save raw stdout output, without timing or other metadata]' \
      '--stdin[enable stdin (keyboard) recording]' \
      '(-t --title)'{-t+,--title=}'[specify title of recording]:title' \
      '(--append)--overwrite[overwrite existing recording]' \
      '(-y --yes)'{-y,--yes}'[bypass confirmation prompts]' \
      '1::recording file:_files' \
    && ret=0
    ;;
esac

return ret