msynk/_msynk.compdef.zsh

40 lines
1.8 KiB
Bash
Raw Permalink Normal View History

2022-03-13 15:00:56 +01:00
#compdef msynk
# https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Completion-Functions
_config-file()
{
# list all files in $CONFIG_DIR
[[ -z $XDG_CONFIG_HOME ]] && XDG_CONFIG_HOME=~/.config
opts=($(ls $XDG_CONFIG_HOME/msynk))
# -s separator, descritions options
_values -s , 'config files' $opts
}
_msynk()
{
# each argument is
# n:message:action
# option[description]:message:action
# *option offer multiple times
_arguments \
{--help,-h}'[We all need it at times...]' \
{--settings,-s}'[Show current settings.]' \
{--config,-c}'[Use sender, receiver, paths from config file]':config:_config-file \
'--show-config[Print variables defined by a config file.]':config:_config-file \
{--sender,-s}'[Sender directory, with trailing "/".]':directory:_directories \
{--receiver,-r}'[Receiver directory, with trailing "/".]':directory:_directories \
'--reverse[Swap receiver and sender.]' \
2023-10-26 18:15:40 +02:00
{--relative,-R}'[User relative path names.]' \
2022-03-13 15:00:56 +01:00
'--encrypt[Encrypt files before syncing.]' \
'--decrypt[Decrypt files before syncing.]' \
'--check-date[Only process files that have been modified since the program was last run. Needs -c and (--encrypt/--decrypt).]' \
'*--mkrypt-flag[Additional argument for mkrypt.]':mkrypt-flag:_mkrypt \
{--delete,-d}'[Delete files that exist on receiver, but not on sender. Does not work with --encrypt/--decrypt.]' \
'--skip-dryrun[Delete without asking first.]' \
'*--rsync-flag[Additional argument for rsync.]':rsync-flag:_rsync \
{--verbose,-v}'[Increase verbosity.]' \
'--silent[Decrease verbosity.]' \
'--debug[Maximum verbosity.]' \
2022-04-08 01:56:55 +02:00
'--exclude[Interpret positional arguments as blacklist]' \
2022-03-13 15:00:56 +01:00
'*:file or directory:_files'
}
_msynk "$@"