Organized

This commit is contained in:
Jason Thistlethwaite
2026-10-17 20:50:35 -04:00
parent bd26c8894f
commit 9ee9eb3ec6
130 changed files with 24172 additions and 140 deletions
+103
View File
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# Bash completion for redmine_contacts.py
# Usage:
# source /path/to/redmine_contacts_completion.sh
# Or copy into /etc/bash_completion.d/ (or ~/.local/share/bash-completion/completions/)
_redmine_contacts_completion() {
local cur prev cmd i
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
local global_opts="--base-url --project --cache -h --help"
local commands="fetch search show update batch-update loop-run helpdesk-ticket issue-full helpdesk-issues helpdesk-messages helpdesk-timeline"
# Determine active subcommand (first non-option token after argv0)
cmd=""
for ((i=1; i<${#COMP_WORDS[@]}; i++)); do
if [[ "${COMP_WORDS[i]}" != -* ]]; then
cmd="${COMP_WORDS[i]}"
break
fi
done
# Value completion for option arguments
case "${prev}" in
--cache|--profile)
COMPREPLY=( $(compgen -f -- "${cur}") )
return 0
;;
--cache-mode)
COMPREPLY=( $(compgen -W "full filtered" -- "${cur}") )
return 0
;;
--source)
if [[ "${cmd}" == "show" ]]; then
COMPREPLY=( $(compgen -W "auto cache api" -- "${cur}") )
else
COMPREPLY=( $(compgen -W "cache api" -- "${cur}") )
fi
return 0
;;
--contact-source)
COMPREPLY=( $(compgen -W "api cache auto" -- "${cur}") )
return 0
;;
--order)
COMPREPLY=( $(compgen -W "as-is oldest-updated-first newest-updated-first oldest-created-first newest-created-first id-asc id-desc" -- "${cur}") )
return 0
;;
--set)
COMPREPLY=( $(compgen -W "first_name= middle_name= last_name= company= website= skype_name= birthday= job_title= background= phone= email= tag_list=" -- "${cur}") )
return 0
;;
--set-custom-field)
COMPREPLY=( $(compgen -W "account-number= instagram= facebook= youtube= linkedin= whatsapp= x-twitter=" -- "${cur}") )
return 0
;;
esac
# If no command selected yet, complete command names + global options
if [[ -z "${cmd}" ]]; then
COMPREPLY=( $(compgen -W "${commands} ${global_opts}" -- "${cur}") )
return 0
fi
local common_filter_opts="--created-after --created-before --updated-after --updated-before --with-tag --without-tag --no-tags"
case "${cmd}" in
fetch)
COMPREPLY=( $(compgen -W "${global_opts} --limit --cache-mode ${common_filter_opts}" -- "${cur}") )
;;
search)
COMPREPLY=( $(compgen -W "${global_opts} --refresh --offline-cache --limit --min-score ${common_filter_opts}" -- "${cur}") )
;;
show)
COMPREPLY=( $(compgen -W "${global_opts} --source --refresh-cache" -- "${cur}") )
;;
update)
COMPREPLY=( $(compgen -W "${global_opts} --set --add-tag --remove-tag --set-custom-field --contact-source --apply" -- "${cur}") )
;;
batch-update)
COMPREPLY=( $(compgen -W "${global_opts} --max-contacts --order --source --refresh-cache ${common_filter_opts} --set --add-tag --remove-tag --set-custom-field --apply" -- "${cur}") )
;;
loop-run)
COMPREPLY=( $(compgen -W "${global_opts} --profile --max-contacts --order --source --refresh-cache ${common_filter_opts} --apply" -- "${cur}") )
;;
helpdesk-ticket)
COMPREPLY=( $(compgen -W "${global_opts}" -- "${cur}") )
;;
issue-full)
COMPREPLY=( $(compgen -W "${global_opts} --message-limit" -- "${cur}") )
;;
helpdesk-issues|helpdesk-messages|helpdesk-timeline)
COMPREPLY=( $(compgen -W "${global_opts} --limit" -- "${cur}") )
;;
esac
return 0
}
complete -F _redmine_contacts_completion redmine_contacts.py
complete -F _redmine_contacts_completion redmine_contacts