summary refs log tree commit diff
path: root/Completion/Zsh/Command/_fc
blob: bcbb4928e94765f55df1f3fad5c900e49c9f0713 (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
#compdef fc history r

local fc_common fc_hist fc_r

fc_common=(
  '(-A -R -W -I)-r[reverse order of the commands]'
  '(-A -R -W -I -e)-n[suppress line numbers]'
  '(-A -R -W -I)*::commands:_command_names -e' )

fc_hist=(
  '(-A -R -W -I)-m[treat first argument as a pattern]'
  '(-A -R -W -I -e -f -E -i)-d[print time-stamps]'
  '(-A -R -W -I -e -d -E -i)-f[mm/dd/yyyy format time-stamps]'
  '(-A -R -W -I -e -d -f -i)-E[dd.mm.yyyy format time-stamps]'
  '(-A -R -W -I -e -d -f -E)-i[yyyy-mm-dd format time-stamps]'
  '(-A -R -W -I -e)-D[print elapsed times]' )

fc_r='(-A -R -W -I -e)-l[list resulting commands on stdout]'

case $service in
  history)
    _arguments -s -S "$fc_common[@]" "$fc_hist[@]" && return 0
  ;;
  r)
    _arguments -s -S "$fc_common[@]" "$fc_r" && return 0
  ;;
  *)
  _arguments -s -S \
    '(-A -R -W -I -l -n -d -f -E -i -D)-e[specify editor to invoke]:editor to invoke:_command_names -e' \
    '(-l -m -e -r -n -d -f -E -i -D -A -W *)-R[read history from file]:history file:_files' \
    '(-l -m -e -r -n -d -f -E -i -D -R -W *)-A[append history to file]:history file:_files' \
    '(-l -m -e -r -n -d -f -E -i -D -R -A *)-W[write history to file]:history file:_files' \
    '(-l -m -e -r -n -d -f -E -i -D -A -W *)-I[read/write new events only]:history file:_files' \
    "$fc_common[@]" "$fc_hist[@]" "$fc_r" && return 0
  ;;
esac