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
|
2022-12-16 01:23:06 +01:00
|
|
|
_values 'config files' *.conf
|
2022-12-14 14:55:04 +01:00
|
|
|
}
|
|
|
|
_csv-file() {
|
2022-12-16 01:23:06 +01:00
|
|
|
_values 'geoip city database as csv' *.csv *.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 "$@"
|