feat(slice-6): implement config loader, CLI check mode, comprehensive documentation, and shell completions

This commit is contained in:
soda64 committed 2026-10-03 09:06:51 +02:00
1 parent 869fd241e7
commit e5784db650
9 files changed
+616 -29

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
# Bash completion script for inventory-collector
_inventory_collector_completion() {
local cur prev opts formats
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-o --output -f --format -s --source --check --dry-run --list --sync -c --config -V --version -h --help"
formats="ansible-yaml ansible-json linux-connector yaml xml ini"
case "${prev}" in
-f|--format)
COMPREPLY=( $(compgen -W "${formats}" -- "${cur}") )
return 0
;;
-o|--output|-s|--source|-c|--config)
COMPREPLY=( $(compgen -f -- "${cur}") )
return 0
;;
esac
if [[ "${cur}" == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
}
complete -F _inventory_collector_completion inventory-collector
+27
View File
@@ -0,0 +1,27 @@
#compdef inventory-collector
_inventory_collector() {
local -a formats
formats=(
'ansible-yaml:Standard Ansible YAML inventory format'
'ansible-json:Ansible dynamic inventory JSON with _meta.hostvars'
'linux-connector:YAML schema formatted for linux-connector'
'yaml:Clean generic YAML dictionary'
'xml:Standard pretty-printed XML inventory'
'ini:Ansible INI inventory format'
)
_arguments \
'(-o --output)'{-o,--output}'[Target output file path]:file:_files' \
'(-f --format)'{-f,--format}'[Export format]:format:(ansible-yaml ansible-json linux-connector yaml xml ini)' \
'*-s[Path to static inventory file (.ini or .yaml)]:file:_files' \
'*--source[Path to static inventory file (.ini or .yaml)]:file:_files' \
'(--check --dry-run)'{--check,--dry-run}'[Inspect inventory without writing any files]' \
'--list[Ansible dynamic inventory mode: outputs JSON to stdout]' \
'--sync[Synchronize inventory to both Ansible and linux-connector default paths]' \
'(-c --config)'{-c,--config}'[Path to configuration file]:file:_files' \
'(-V --version)'{-V,--version}'[Show program version and exit]' \
'(-h --help)'{-h,--help}'[Show help message and exit]'
}
_inventory_collector "$@"