File: _osascript

package info (click to toggle)
zsh 5.9-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie, trixie-proposed-updates
  • size: 23,856 kB
  • sloc: ansic: 108,138; sh: 6,976; makefile: 722; perl: 687; awk: 291; sed: 16
file content (34 lines) | stat: -rw-r--r-- 967 bytes parent folder | download | duplicates (4)
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
#compdef osascript

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

_arguments -s -S : \
  '-l+[specify script language]: :->languages' \
  '(:)*-e+[execute specified line of script]:script' \
  '-i[run interactively]' \
  '*-s+[specify output style]: :->modifiers' \
  '(-e)1:script file:_files' \
&& ret=0

case $state in
  languages)
    # So far, the three languages specified here are the only ones supported,
    # but adding the output of osalang makes this future-proof
    _values 'script language' \
      AppleScript JavaScript 'Generic Scripting System' \
      ${(f)"$( _call_program languages command osalang )"} \
    && ret=0
    ;;
  modifiers)
    _values -S '' 'output modifier flag' \
      'h[print values in human-readable form]' \
      's[print values in recompilable source form]' \
      'e[print script errors to stderr]' \
      'o[print script errors to stdout]' \
    && ret=0
    ;;
esac

return ret