initial commit
This commit is contained in:
@@ -0,0 +1,401 @@
|
||||
#compdef ca-certs
|
||||
|
||||
autoload -U is-at-least
|
||||
|
||||
_ca-certs() {
|
||||
typeset -A opt_args
|
||||
typeset -a _arguments_options
|
||||
local ret=1
|
||||
|
||||
if is-at-least 5.2; then
|
||||
_arguments_options=(-s -S -C)
|
||||
else
|
||||
_arguments_options=(-s -C)
|
||||
fi
|
||||
|
||||
local context curcontext="$curcontext" state line
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
'-V[Print version]' \
|
||||
'--version[Print version]' \
|
||||
":: :_ca-certs_commands" \
|
||||
"*::: :->ca-certs" \
|
||||
&& ret=0
|
||||
case $state in
|
||||
(ca-certs)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:ca-certs-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(add)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'-n+[Output certificate name (without extension). Defaults to the input filename stem]:NAME:_default' \
|
||||
'--name=[Output certificate name (without extension). Defaults to the input filename stem]:NAME:_default' \
|
||||
'-o+[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:OUTPUT:_files' \
|
||||
'--output=[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:OUTPUT:_files' \
|
||||
'--root=[Target root filesystem (for chroot/image builds)]:ROOT:_files' \
|
||||
'--force[Overwrite an existing anchor if contents differ]' \
|
||||
'--no-extract[Add certificate but do not run extraction]' \
|
||||
'--dry-run[Print actions without modifying files]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':cert -- Path to a PEM-encoded CA certificate:_files' \
|
||||
&& ret=0
|
||||
;;
|
||||
(extract)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'-o+[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:OUTPUT:_files' \
|
||||
'--output=[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:OUTPUT:_files' \
|
||||
'--root=[Target root filesystem (for chroot/image builds)]:ROOT:_files' \
|
||||
'--dry-run[Print actions without modifying files]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(certdata)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
":: :_ca-certs__certdata_commands" \
|
||||
"*::: :->certdata" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(certdata)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:ca-certs-certdata-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(fetch)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'--url=[Source URL for certdata.txt]:URL:_default' \
|
||||
'--log-url=[Override log URL used to determine the latest revision (optional)]:LOG_URL:_default' \
|
||||
'-o+[Output file path]:OUTPUT:_files' \
|
||||
'--output=[Output file path]:OUTPUT:_files' \
|
||||
'--force[Overwrite an existing file if contents differ]' \
|
||||
'--no-revision-check[Always download even if the local file revision matches the remote revision]' \
|
||||
'--no-parse[Skip parsing/summary after download]' \
|
||||
'--dry-run[Print actions without modifying files]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(parse)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'--limit=[Print up to N object summaries after the aggregate stats]:LIMIT:_default' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
'::input -- Path to certdata.txt:_files' \
|
||||
&& ret=0
|
||||
;;
|
||||
(convert)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'--root=[Target root filesystem (for chroot/image builds)]:ROOT:_files' \
|
||||
'--output=[Destination p11-kit trust source file inside the target root]:OUTPUT:_files' \
|
||||
'-o+[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:EXTRACT_OUTPUT:_files' \
|
||||
'--extract-output=[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:EXTRACT_OUTPUT:_files' \
|
||||
'--force[Overwrite an existing output file if contents differ]' \
|
||||
'--no-extract[Skip running trust extraction after writing the Mozilla source bundle]' \
|
||||
'--dry-run[Print actions without modifying files]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
'::input -- Path to certdata.txt:_files' \
|
||||
&& ret=0
|
||||
;;
|
||||
(sync)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'--url=[Source URL for certdata.txt]:URL:_default' \
|
||||
'--log-url=[Override log URL used to determine the latest revision (optional)]:LOG_URL:_default' \
|
||||
'--certdata-output=[Local certdata.txt path used for fetch and convert]:CERTDATA_OUTPUT:_files' \
|
||||
'--root=[Target root filesystem (for chroot/image builds)]:ROOT:_files' \
|
||||
'--mozilla-output=[Destination p11-kit trust source file inside the target root]:MOZILLA_OUTPUT:_files' \
|
||||
'-o+[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:EXTRACT_OUTPUT:_files' \
|
||||
'--extract-output=[Extracted output directory inside the target root (default\: /etc/ca-certificates/extracted)]:EXTRACT_OUTPUT:_files' \
|
||||
'--force[Overwrite existing files if contents differ]' \
|
||||
'--no-revision-check[Always download even if the local certdata revision matches the remote revision]' \
|
||||
'--no-parse[Skip parsing/summary after download]' \
|
||||
'--no-extract[Skip running trust extraction after writing the Mozilla source bundle]' \
|
||||
'--dry-run[Print actions without modifying files]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
":: :_ca-certs__certdata__help_commands" \
|
||||
"*::: :->help" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(help)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:ca-certs-certdata-help-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(fetch)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(parse)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(convert)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(sync)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(gen-artifacts)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'--out-dir=[Directory to write generated packaging artifacts into]:OUT_DIR:_files' \
|
||||
'*--shell=[Shell completions to generate]:SHELLS:(bash fish zsh)' \
|
||||
'--dry-run[Print actions without modifying files]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
":: :_ca-certs__help_commands" \
|
||||
"*::: :->help" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(help)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:ca-certs-help-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(add)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(extract)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(certdata)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
":: :_ca-certs__help__certdata_commands" \
|
||||
"*::: :->certdata" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(certdata)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:ca-certs-help-certdata-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(fetch)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(parse)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(convert)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(sync)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(gen-artifacts)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
(( $+functions[_ca-certs_commands] )) ||
|
||||
_ca-certs_commands() {
|
||||
local commands; commands=(
|
||||
'add:Add a PEM CA certificate to trust-source/anchors and refresh extracted outputs' \
|
||||
'extract:Regenerate extracted trust bundles (like update-ca-trust extract)' \
|
||||
'certdata:Fetch and parse Mozilla/NSS certdata.txt (no certificate generation yet)' \
|
||||
'gen-artifacts:' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'ca-certs commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__add_commands] )) ||
|
||||
_ca-certs__add_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs add commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata_commands] )) ||
|
||||
_ca-certs__certdata_commands() {
|
||||
local commands; commands=(
|
||||
'fetch:Fetch certdata.txt from an NSS source URL' \
|
||||
'parse:Parse a local certdata.txt file and print a summary' \
|
||||
'convert:Convert certdata.txt into a Mozilla p11-kit trust bundle and optionally extract outputs' \
|
||||
'sync:Run the full pipeline\: fetch certdata.txt, convert to p11-kit source, then extract outputs' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'ca-certs certdata commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__convert_commands] )) ||
|
||||
_ca-certs__certdata__convert_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata convert commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__fetch_commands] )) ||
|
||||
_ca-certs__certdata__fetch_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata fetch commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__help_commands] )) ||
|
||||
_ca-certs__certdata__help_commands() {
|
||||
local commands; commands=(
|
||||
'fetch:Fetch certdata.txt from an NSS source URL' \
|
||||
'parse:Parse a local certdata.txt file and print a summary' \
|
||||
'convert:Convert certdata.txt into a Mozilla p11-kit trust bundle and optionally extract outputs' \
|
||||
'sync:Run the full pipeline\: fetch certdata.txt, convert to p11-kit source, then extract outputs' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'ca-certs certdata help commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__help__convert_commands] )) ||
|
||||
_ca-certs__certdata__help__convert_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata help convert commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__help__fetch_commands] )) ||
|
||||
_ca-certs__certdata__help__fetch_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata help fetch commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__help__help_commands] )) ||
|
||||
_ca-certs__certdata__help__help_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata help help commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__help__parse_commands] )) ||
|
||||
_ca-certs__certdata__help__parse_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata help parse commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__help__sync_commands] )) ||
|
||||
_ca-certs__certdata__help__sync_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata help sync commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__parse_commands] )) ||
|
||||
_ca-certs__certdata__parse_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata parse commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__certdata__sync_commands] )) ||
|
||||
_ca-certs__certdata__sync_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs certdata sync commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__extract_commands] )) ||
|
||||
_ca-certs__extract_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs extract commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__gen-artifacts_commands] )) ||
|
||||
_ca-certs__gen-artifacts_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs gen-artifacts commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help_commands] )) ||
|
||||
_ca-certs__help_commands() {
|
||||
local commands; commands=(
|
||||
'add:Add a PEM CA certificate to trust-source/anchors and refresh extracted outputs' \
|
||||
'extract:Regenerate extracted trust bundles (like update-ca-trust extract)' \
|
||||
'certdata:Fetch and parse Mozilla/NSS certdata.txt (no certificate generation yet)' \
|
||||
'gen-artifacts:' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'ca-certs help commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__add_commands] )) ||
|
||||
_ca-certs__help__add_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help add commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__certdata_commands] )) ||
|
||||
_ca-certs__help__certdata_commands() {
|
||||
local commands; commands=(
|
||||
'fetch:Fetch certdata.txt from an NSS source URL' \
|
||||
'parse:Parse a local certdata.txt file and print a summary' \
|
||||
'convert:Convert certdata.txt into a Mozilla p11-kit trust bundle and optionally extract outputs' \
|
||||
'sync:Run the full pipeline\: fetch certdata.txt, convert to p11-kit source, then extract outputs' \
|
||||
)
|
||||
_describe -t commands 'ca-certs help certdata commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__certdata__convert_commands] )) ||
|
||||
_ca-certs__help__certdata__convert_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help certdata convert commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__certdata__fetch_commands] )) ||
|
||||
_ca-certs__help__certdata__fetch_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help certdata fetch commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__certdata__parse_commands] )) ||
|
||||
_ca-certs__help__certdata__parse_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help certdata parse commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__certdata__sync_commands] )) ||
|
||||
_ca-certs__help__certdata__sync_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help certdata sync commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__extract_commands] )) ||
|
||||
_ca-certs__help__extract_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help extract commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__gen-artifacts_commands] )) ||
|
||||
_ca-certs__help__gen-artifacts_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help gen-artifacts commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_ca-certs__help__help_commands] )) ||
|
||||
_ca-certs__help__help_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'ca-certs help help commands' commands "$@"
|
||||
}
|
||||
|
||||
if [ "$funcstack[1]" = "_ca-certs" ]; then
|
||||
_ca-certs "$@"
|
||||
else
|
||||
compdef _ca-certs ca-certs
|
||||
fi
|
||||
Reference in New Issue
Block a user