Debian Codegraph @

completion/zsh/_hwatch

raw
1 #compdef hwatch
2
3 autoload -U is-at-least
4
5 _hwatch() {
6 typeset -A opt_args
7 typeset -a _arguments_options
8 local ret=1
9
10 if is-at-least 5.2; then
11 _arguments_options=(-s -S -C)
12 else
13 _arguments_options=(-s -C)
14 fi
15
16 local context curcontext="$curcontext" state line
17 _arguments "${_arguments_options[@]}" : \
18 '*-A+[Executes the specified command if the output changes. Information about changes is stored in json format in environment variable \${HWATCH_DATA}.]: :_cmdstring' \
19 '*--aftercommand=[Executes the specified command if the output changes. Information about changes is stored in json format in environment variable \${HWATCH_DATA}.]: :_cmdstring' \
20 '*-l+[logging file]' \
21 '*--logfile=[logging file]' \
22 '*-s+[shell to use at runtime. can also insert the command to the location specified by {COMMAND}.]: :_cmdstring' \
23 '*--shell=[shell to use at runtime. can also insert the command to the location specified by {COMMAND}.]: :_cmdstring' \
24 '*-n+[seconds to wait between updates]: : ' \
25 '*--interval=[seconds to wait between updates]: : ' \
26 '--precise[Attempt to run as close to the interval as possible, regardless of how long the command takes to run]: : ' \
27 '-L+[Set the number of history records to keep. only work in watch mode. Set \`0\` for unlimited recording. (default\: 5000)]: : ' \
28 '--limit=[Set the number of history records to keep. only work in watch mode. Set \`0\` for unlimited recording. (default\: 5000)]: : ' \
29 '*--tab-size=[Specifying tab display size]: : ' \
30 '*-d+[highlight changes between updates]' \
31 '*--differences=[highlight changes between updates]' \
32 '*-o+[Select command output.]' \
33 '*--output=[Select command output.]' \
34 '*-K+[Add keymap]: : ' \
35 '*--keymap=[Add keymap]: : ' \
36 '--completion=[Output shell completion script]: :(bash fish zsh)' \
37 '-b[output exection results to stdout]' \
38 '--batch[output exection results to stdout]' \
39 '-B[beep if command has a change result]' \
40 '--beep[beep if command has a change result]' \
41 '*-g[exit when output changes. With no value, exits after the first change; with N, exits after N changes]:count: ' \
42 '*--chgexit=[exit when output changes. With no value, exits after the first change; with N, exits after N changes]:count: ' \
43 '--border[Surround each pane with a border frame]' \
44 '--with-scrollbar[When the border option is enabled, display scrollbar on the right side of watch pane.]' \
45 '--mouse[enable mouse wheel support. With this option, copying text with your terminal may be harder. Try holding the Shift key.]' \
46 '-c[interpret ANSI color and style sequences]' \
47 '--color[interpret ANSI color and style sequences]' \
48 '-r[display text upside down.]' \
49 '--reverse[display text upside down.]' \
50 '-C[Compress data in memory. Note\: If the output of the command is small, you may not get the desired effect.]' \
51 '--compress[Compress data in memory. Note\: If the output of the command is small, you may not get the desired effect.]' \
52 '-t[hide the UI on start. Use \`t\` to toggle it.]' \
53 '--no-title[hide the UI on start. Use \`t\` to toggle it.]' \
54 '-N[show line number]' \
55 '--line-number[show line number]' \
56 '--no-help-banner[hide the "Display help with h key" message]' \
57 '-x[Run the command directly, not through the shell. Much like the \`-x\` option of the watch command.]' \
58 '--exec[Run the command directly, not through the shell. Much like the \`-x\` option of the watch command.]' \
59 '-O[Display only the lines with differences during \`line\` diff and \`word\` diff.]' \
60 '--diff-output-only[Display only the lines with differences during \`line\` diff and \`word\` diff.]' \
61 '-h[Print help]' \
62 '--help[Print help]' \
63 '-V[Print version]' \
64 '--version[Print version]' \
65 '*::command:_hwatch_command' \
66 && ret=0
67 }
68
69 (( $+functions[_hwatch_commands] )) ||
70 _hwatch_commands() {
71 local commands; commands=()
72 _describe -t commands 'hwatch commands' commands "$@"
73 }
74
75 _hwatch_command() {
76 local -a cmd_words
77 local cmd_index i
78
79 cmd_words=("${words[@]}")
80 cmd_index=0
81
82 for ((i=2; i<=${#cmd_words}; i++)); do
83 case "${cmd_words[i]}" in
84 --)
85 cmd_index=$((i + 1))
86 break
87 ;;
88 -A|--aftercommand|-l|--logfile|-s|--shell|-n|--interval|-L|--limit|--tab-size|-K|--keymap|--completion|-g|--chgexit)
89 i=$((i + 1))
90 ;;
91 -d|--differences)
92 if [[ "${cmd_words[i+1]}" == "none" || "${cmd_words[i+1]}" == "watch" || "${cmd_words[i+1]}" == "line" || "${cmd_words[i+1]}" == "word" ]]; then
93 i=$((i + 1))
94 fi
95 ;;
96 -o|--output)
97 if [[ "${cmd_words[i+1]}" == "output" || "${cmd_words[i+1]}" == "stdout" || "${cmd_words[i+1]}" == "stderr" ]]; then
98 i=$((i + 1))
99 fi
100 ;;
101 -* )
102 ;;
103 *)
104 cmd_index=$i
105 break
106 ;;
107 esac
108 done
109
110 if (( cmd_index > 0 )); then
111 words=("${words[@]:$((cmd_index - 1))}")
112 CURRENT=$((CURRENT - cmd_index + 1))
113 if (( CURRENT < 1 )); then
114 CURRENT=1
115 fi
116 _normal
117 else
118 _command_names -e
119 fi
120 }
121
122 if [ "$funcstack[1]" = "_hwatch" ]; then
123 _hwatch "$@"
124 else
125 compdef _hwatch hwatch
126 fi