| 1 |
#compdef sensors |
| 2 |
|
| 3 |
# List of adapters. This depends on jq to parse the json output. |
| 4 |
_sensors_adapaters() { |
| 5 |
declare -a adapters |
| 6 |
eval set -A adapters "$(sensors -j | jq -r 'keys|@sh')" |
| 7 |
_values adapter $adapters |
| 8 |
} |
| 9 |
|
| 10 |
_sensors() { |
| 11 |
typeset -a args |
| 12 |
|
| 13 |
args=( |
| 14 |
'--bus-list[generate bus statements for sensors.conf]' |
| 15 |
'--no-adapter[do not show adapter for each chip]' |
| 16 |
'-A[do not show adapter for each chip]' |
| 17 |
'-j[json output]' |
| 18 |
'-u[raw output]' |
| 19 |
'(--allow-no-sensors -n)'{--allow-no-sensors,-n}'[do not fail if no sensors found]' |
| 20 |
'(--config-file -c)'{--config-file,-c}'[specify a config file]:file:_files' |
| 21 |
'(--fahrenheit -f)'{--fahrenheit,-f}'[show temperatures in degrees fahrenheit]' |
| 22 |
'(--set -s)'{--set,-s}'[execute `set'\'' statements (root only)]' |
| 23 |
'(-)'{--help,-h}'[display help text]' |
| 24 |
'(-)'{--version,-v}'[display the program version]' |
| 25 |
'*:chip:_sensors_adapaters' |
| 26 |
) |
| 27 |
|
| 28 |
_arguments $args |
| 29 |
} |