zsh-workers
 help / color / mirror / code / Atom feed
920e4af616ede1f1d2468ee9a4d6b17e1ffd6bc2 blob 1953 bytes (raw)

 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
 
#compdef crontab

# Notes:
# - We assume a cronie or Vixie-esque crontab
# - @todo As usual, BusyBox multi-call isn't handled

local variant sluser
local -a args etargs ccargs clargs rcargs aopts

_pick_variant -r variant \
  busybox=BusyBox \
  cronie-selinux='(#i)selinux' \
  cronie='(#i)cluster' \
  unix --help
variant+=-$OSTYPE

# On Solaris, instead of using -u, the user can be specified as an optional
# first operand with -e/-l/-r. We'll treat it as an optional *argument* to one
# of those options, though, since the logic is a bit simpler
if [[ $variant == *-solaris* ]]; then
  sluser='::user whose crontab to work with:_users'
else
  etargs+=( '(cl)-u+[specify user whose crontab to work with]: :_users' )
fi

case $variant in
  busybox-*)
    etargs+=( '-c+[specify crontab directory]:crontab directory:_directories' )
    ;;
  cronie-selinux-*)
    ccargs+=( '(-l cl nc rc)-s[append SELinux context (with -e)]' )
    ;& # FALL THROUGH
  cronie-*)
    etargs+=( '(: * -)-V[display version information]' )
    clargs+=(
      '(: * -)-c[display cluster host]'
      '(: * -)-n+[specify cluster host]: :_hosts'
    )
    ;& # FALL THROUGH
  *-linux*)
    rcargs+=( '(cc cl nc)-i[prompt for confirmation (with -r)]' )
    ;;
  *-freebsd*)
    rcargs+=( '(cc cl nc)-f[bypass confirmation prompt (with -r)]' )
    ;;
esac

(( $#etargs )) && args+=( + et $etargs ) # Misc.
(( $#clargs )) && args+=( + cl $clargs ) # Work with cluster
args+=(
  + nc # Install new crontab
  '(cc cl rc sl):crontab to install:_files'
  + cc # Edit/display current crontab
  "(-l cl nc rc)-e[edit current crontab]$sluser"
  "(-e -s cl nc rc)-l[display current crontab]$sluser"
  $ccargs
  + rc # Remove current crontab
  "(cc cl nc)-r[remove current crontab]$sluser"
  $rcargs
)

# Implementations that use GNU's getopt(3) probably support permutation; this
# should be accurate enough
[[ $OSTYPE == linux* ]] || aopts=( -A '-*' )

_arguments -s -S $aopts : $args
debug log:

solving 920e4af61 ...
found 920e4af61 in https://inbox.vuxu.org/zsh-workers/7D9389BF-A420-4B9F-9BCD-B7FD34B06FB4@dana.is/

applying [1/1] https://inbox.vuxu.org/zsh-workers/7D9389BF-A420-4B9F-9BCD-B7FD34B06FB4@dana.is/
diff --git a/Completion/Unix/Command/_crontab b/Completion/Unix/Command/_crontab
new file mode 100644
index 000000000..920e4af61

Checking patch Completion/Unix/Command/_crontab...
Applied patch Completion/Unix/Command/_crontab cleanly.

index at:
100644 920e4af616ede1f1d2468ee9a4d6b17e1ffd6bc2	Completion/Unix/Command/_crontab

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).