regina/_regina.compdef.zsh

26 lines
887 B
Bash
Raw Normal View History

2022-12-14 14:55:04 +01:00
#compdef regina
2022-11-23 02:00:43 +01:00
# https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Completion-Functions
2022-12-14 14:55:04 +01:00
_config-file() {
# list all files that end in .conf
# -s separator, descritions options
_values -s , 'config files' $(find . -type f -name '*.conf')
}
_csv-file() {
_values -s , 'geoip city database as csv' $(find . -type f -name '*.csv')
2022-11-23 02:00:43 +01:00
}
2022-12-14 14:55:04 +01:00
_regina() {
2022-11-23 02:00:43 +01:00
# each argument is
# n:message:action
# option[description]:message:action
# # -s allow stacking, eg -inr
_arguments -s \
2022-12-14 14:55:04 +01:00
{--help,-h}'[show help]' \
{--config,-c}'[use this config file]':config:_config-file \
'--visualize[visualize the data in the database]' \
'--collect[collect requests from the nginx log]' \
'--access-log[source this logfile]':logfile:_file \
'--update-geoip[recreate the geoip database from csv]':csv:_csv-file
2022-11-23 02:00:43 +01:00
}
2022-12-14 14:55:04 +01:00
_regina "$@"