release: restore ZUPT and harden source-only 5.2.2
This commit is contained in:
parent
74e393ba3e
commit
ff99770bd0
205 changed files with 19627 additions and 13215 deletions
|
|
@ -1,136 +0,0 @@
|
|||
#compdef vaptvupt zupt
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) 2025-2026 Cristian Cezar Moisés
|
||||
#
|
||||
# Install:
|
||||
# sudo install -m 644 completions/_zupt /usr/share/zsh/site-functions/_zupt
|
||||
# or for a single user (anywhere in $fpath):
|
||||
# cp completions/_zupt ~/.zsh/completion/_zupt
|
||||
# # then in ~/.zshrc:
|
||||
# # fpath=(~/.zsh/completion $fpath)
|
||||
# # autoload -U compinit && compinit
|
||||
|
||||
_zupt_levels() {
|
||||
_values 'compression level' \
|
||||
'1[fastest, smallest window]' \
|
||||
'2[fast]' \
|
||||
'3[balanced (low)]' \
|
||||
'4[balanced]' \
|
||||
'5[balanced (high)]' \
|
||||
'6[high compression]' \
|
||||
'7[default; high]' \
|
||||
'8[maximum, 1MB window]' \
|
||||
'9[maximum, deep search]'
|
||||
}
|
||||
|
||||
_zupt_kdf() {
|
||||
_values 'KDF' \
|
||||
'argon2id[memory-hard, default since v2.4.1]' \
|
||||
'pbkdf2[legacy 600k-iter PBKDF2-SHA256]'
|
||||
}
|
||||
|
||||
_zupt_threads() {
|
||||
_values 'threads' '0[auto]' '1' '2' '4' '8' '16' '32' '64'
|
||||
}
|
||||
|
||||
_zupt_compress_opts() {
|
||||
_arguments \
|
||||
'(-l --level)'{-l,--level}'[compression level]:level:_zupt_levels' \
|
||||
'(-b --block)'{-b,--block}'[block size in bytes]:size:' \
|
||||
'(-s --store)'{-s,--store}'[store without compression]' \
|
||||
'(-f --fast)'{-f,--fast}'[use fast LZ codec]' \
|
||||
'(--vv --vaptvupt)'{--vv,--vaptvupt}'[use VaptVupt codec]' \
|
||||
'--lzhp[use Zupt-LZHP codec (LZ77+Huffman, no SIMD)]' \
|
||||
'(-p --password)'{-p,--password}'[encrypt with password]:password:' \
|
||||
'--kdf[password KDF]:kdf:_zupt_kdf' \
|
||||
'(-c --comment)'{-c,--comment}'[embed archive comment]:text:' \
|
||||
'--comment-file[read comment from file]:file:_files' \
|
||||
'--pq[legacy PQ encryption]:pubkey:_files' \
|
||||
'--pq-sdk[PQ encryption via libzuptsdk]:pubkey:_files' \
|
||||
'(-D --dedup)'{-D,--dedup}'[block-level deduplication]' \
|
||||
'--solid[solid mode: single stream]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[verbose output]' \
|
||||
'(-q --quiet)'{-q,--quiet}'[suppress non-error output]' \
|
||||
'(-t --threads)'{-t,--threads}'[thread count]:threads:_zupt_threads' \
|
||||
'*:files:_files'
|
||||
}
|
||||
|
||||
_zupt_extract_opts() {
|
||||
_arguments \
|
||||
'(-o --output)'{-o,--output}'[output directory]:directory:_directories' \
|
||||
'(-p --password)'{-p,--password}'[decryption password]:password:' \
|
||||
'--pq[legacy PQ decryption]:privkey:_files' \
|
||||
'--pq-sdk[PQ decryption via libzuptsdk]:privkey:_files' \
|
||||
'(-v --verbose)'{-v,--verbose}'[verbose output]' \
|
||||
'(-t --threads)'{-t,--threads}'[thread count]:threads:_zupt_threads' \
|
||||
'*:archive:_files -g "*.zupt"'
|
||||
}
|
||||
|
||||
_zupt() {
|
||||
local context curcontext="$curcontext" state line
|
||||
local -a subcommands
|
||||
|
||||
subcommands=(
|
||||
'compress:create an archive'
|
||||
'c:create an archive (alias)'
|
||||
'extract:extract an archive'
|
||||
'x:extract an archive (alias)'
|
||||
'list:list archive entries'
|
||||
'l:list archive entries (alias)'
|
||||
'test:verify archive integrity'
|
||||
't:verify archive integrity (alias)'
|
||||
'info:archive metadata (no key needed)'
|
||||
'bench:benchmark levels 1-9'
|
||||
'disk:full-disk backup/restore'
|
||||
'keygen:generate a key file'
|
||||
'version:print version info'
|
||||
'help:print help'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'(-): :->command' \
|
||||
'(-)*:: :->args'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
_describe -t commands 'zupt subcommand' subcommands
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
compress|c)
|
||||
_zupt_compress_opts
|
||||
;;
|
||||
extract|x)
|
||||
_zupt_extract_opts
|
||||
;;
|
||||
list|l|test|t)
|
||||
_arguments \
|
||||
'(-p --password)'{-p,--password}'[password]:password:' \
|
||||
'--pq[legacy PQ privkey]:privkey:_files' \
|
||||
'--pq-sdk[PQ privkey]:privkey:_files' \
|
||||
'(-v --verbose)'{-v,--verbose}'[verbose]' \
|
||||
'*:archive:_files -g "*.zupt"'
|
||||
;;
|
||||
info)
|
||||
_arguments '*:archive:_files -g "*.zupt"'
|
||||
;;
|
||||
disk)
|
||||
_values 'disk action' 'backup' 'restore'
|
||||
;;
|
||||
keygen)
|
||||
_arguments \
|
||||
'--sdk[generate SDK v2 keypair]' \
|
||||
'--pq-sdk[same as --sdk]' \
|
||||
'-o[output keyfile]:file:_files' \
|
||||
'--pub[export public key from -k]' \
|
||||
'-k[source private key for --pub]:file:_files'
|
||||
;;
|
||||
bench)
|
||||
_arguments '*:files:_files'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_zupt "$@"
|
||||
132
completions/_zupt
Normal file
132
completions/_zupt
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
#compdef zupt
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
local context state state_descr line
|
||||
local -a _zupt_disk_legacy_options
|
||||
typeset -A opt_args
|
||||
|
||||
_zupt_password_options=(
|
||||
'(-p --password)'{-p,--password}'[password in process arguments]:password:'
|
||||
'--password-prompt[read password interactively without echo]'
|
||||
'--pass-file[read password from first line of file]:password file:_files'
|
||||
'--pass-fd[read password from inherited file descriptor]:file descriptor:'
|
||||
)
|
||||
|
||||
_zupt_pq_options=(
|
||||
'--pq[native ML-KEM-768 + X25519 hybrid key]:key file:_files'
|
||||
'--pq-only[native ML-KEM-768-only key]:key file:_files'
|
||||
'--pq-sdk[optional system libvuptsdk key]:key file:_files'
|
||||
'--pq-box[optional system libpqvaptvupt key]:key file:_files'
|
||||
)
|
||||
|
||||
_zupt_read_options=(
|
||||
"${_zupt_password_options[@]}"
|
||||
"${_zupt_pq_options[@]}"
|
||||
'(-v --verbose)'{-v,--verbose}'[additional diagnostics]'
|
||||
'--allow-legacy-no-ait[recover a trusted old archive without an integrity trailer]'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1:command:->command' \
|
||||
'*::argument:->arguments'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
_values 'command' \
|
||||
'compress:create an archive' 'c:create an archive' \
|
||||
'extract:extract an archive' 'x:extract an archive' \
|
||||
'list:list archive entries' 'l:list archive entries' \
|
||||
'test:verify archive integrity' 't:verify archive integrity' \
|
||||
'info:show framing metadata' 'i:show framing metadata' \
|
||||
'bench:benchmark compression levels' 'b:benchmark compression levels' \
|
||||
'disk:back up or restore a disk image' \
|
||||
'keygen:generate or export a recipient key' \
|
||||
'version:show version and build information' \
|
||||
'help:show command help' '--version:show version and build information' \
|
||||
'-V:show version and build information' '--help:show command help' \
|
||||
'-h:show command help'
|
||||
;;
|
||||
arguments)
|
||||
case ${line[1]} in
|
||||
compress|c)
|
||||
_arguments \
|
||||
'(-l --level)'{-l,--level}'[compression level]:level:(1 2 3 4 5 6 7 8 9)' \
|
||||
'(-b --block)'{-b,--block}'[block size in bytes]:bytes:' \
|
||||
'(-s --store)'{-s,--store}'[store without compression]' \
|
||||
'(-f --fast)'{-f,--fast}'[use fast LZ codec]' \
|
||||
'(--vv --vaptvupt)'{--vv,--vaptvupt}'[force VaptVupt LZ + ANS codec]' \
|
||||
'--lzhp[force portable LZHP codec]' \
|
||||
"${_zupt_password_options[@]}" \
|
||||
'--kdf[password KDF]:KDF:(pbkdf2 argon2id)' \
|
||||
'(-c --comment)'{-c,--comment}'[archive comment]:comment:' \
|
||||
'--comment-file[read archive comment from file]:comment file:_files' \
|
||||
"${_zupt_pq_options[@]}" \
|
||||
'(-D --dedup)'{-D,--dedup}'[block-level deduplication]' \
|
||||
'(-S --solid)'{-S,--solid}'[solid single-stream compression]' \
|
||||
'(-y --force)'{-y,--force}'[overwrite an existing non-.zupt output]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[additional progress output]' \
|
||||
'(-t --threads)'{-t,--threads}'[compression thread count]:threads:' \
|
||||
'1:output archive:_files -g "*.zupt"' \
|
||||
'*:input file or directory:_files'
|
||||
;;
|
||||
extract|x)
|
||||
_arguments \
|
||||
'(-o --output)'{-o,--output}'[output directory]:directory:_directories' \
|
||||
"${_zupt_read_options[@]}" \
|
||||
'(-t --threads)'{-t,--threads}'[decompression thread count]:threads:' \
|
||||
'1:archive:_files -g "*.zupt"'
|
||||
;;
|
||||
list|l|test|t)
|
||||
_arguments \
|
||||
"${_zupt_read_options[@]}" \
|
||||
'1:archive:_files -g "*.zupt"'
|
||||
;;
|
||||
info|i)
|
||||
_arguments '1:archive:_files -g "*.zupt"'
|
||||
;;
|
||||
bench|b)
|
||||
_arguments '--compare[compare available external compressors]' \
|
||||
'*:input file or directory:_files'
|
||||
;;
|
||||
disk)
|
||||
_zupt_disk_legacy_options=()
|
||||
if [[ ${line[2]-} == restore ]]; then
|
||||
_zupt_disk_legacy_options=(
|
||||
'--allow-legacy-no-ait[recover a trusted old disk archive without an integrity trailer]'
|
||||
)
|
||||
fi
|
||||
_arguments -C \
|
||||
'1:disk command:(backup restore)' \
|
||||
'(-l --level)'{-l,--level}'[compression level]:level:(1 2 3 4 5 6 7 8 9)' \
|
||||
'(-b --block)'{-b,--block}'[block size in bytes]:bytes:' \
|
||||
'(-s --store)'{-s,--store}'[store without compression]' \
|
||||
'(--vv --vaptvupt)'{--vv,--vaptvupt}'[force VaptVupt LZ + ANS codec]' \
|
||||
'--lzhp[force portable LZHP codec]' \
|
||||
"${_zupt_password_options[@]}" \
|
||||
'--kdf[password KDF]:KDF:(pbkdf2 argon2id)' \
|
||||
'(-c --comment)'{-c,--comment}'[archive comment]:comment:' \
|
||||
'--comment-file[read archive comment from file]:comment file:_files' \
|
||||
'--pq[native hybrid key]:key file:_files' \
|
||||
'--pq-only[native ML-KEM-768-only key]:key file:_files' \
|
||||
'(-D --dedup)'{-D,--dedup}'[block-level deduplication]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[additional progress output]' \
|
||||
'(-t --threads)'{-t,--threads}'[thread count]:threads:' \
|
||||
"${_zupt_disk_legacy_options[@]}" \
|
||||
'2:archive:_files' \
|
||||
'3:device or file:_files'
|
||||
;;
|
||||
keygen)
|
||||
_arguments \
|
||||
'(-o --output)'{-o,--output}'[output key file]:output file:_files' \
|
||||
'--pub[export a public key]' \
|
||||
'(-k --key)'{-k,--key}'[source private key]:private key:_files' \
|
||||
'(--pq-only --pqonly)'{--pq-only,--pqonly}'[native ML-KEM-768-only key format]' \
|
||||
'(--sdk --pq-sdk)'{--sdk,--pq-sdk}'[optional system libvuptsdk key format]' \
|
||||
'(--box --pq-box)'{--box,--pq-box}'[optional system libpqvaptvupt key format]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
unset _zupt_password_options _zupt_pq_options _zupt_read_options
|
||||
unset _zupt_disk_legacy_options
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
# bash completion for vaptvupt (with `zupt` legacy alias)
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) 2025-2026 Cristian Cezar Moisés
|
||||
#
|
||||
# Install (system-wide):
|
||||
# sudo install -m 644 completions/vaptvupt.bash /usr/share/bash-completion/completions/vaptvupt
|
||||
# sudo ln -sf vaptvupt /usr/share/bash-completion/completions/zupt
|
||||
# or for a single user:
|
||||
# cp completions/vaptvupt.bash ~/.local/share/bash-completion/completions/vaptvupt
|
||||
#
|
||||
# Reload your shell or `source` the file to pick up changes.
|
||||
|
||||
_vaptvupt() {
|
||||
local cur prev words cword
|
||||
_init_completion -n = 2>/dev/null || {
|
||||
# _init_completion missing on this host; fall back to manual setup.
|
||||
local IFS=$' \t\n'
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
cword=$COMP_CWORD
|
||||
words=("${COMP_WORDS[@]}")
|
||||
}
|
||||
|
||||
local subcommands="compress c extract x list l test t info bench disk keygen version help"
|
||||
local global_opts="-v --verbose -q --quiet -t --threads -h --help"
|
||||
|
||||
# First positional → subcommand
|
||||
if [ "$cword" -eq 1 ]; then
|
||||
COMPREPLY=( $(compgen -W "$subcommands" -- "$cur") )
|
||||
return 0
|
||||
fi
|
||||
|
||||
local subcmd="${words[1]}"
|
||||
|
||||
case "$prev" in
|
||||
-p|--password)
|
||||
# Don't complete passwords from filesystem
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
;;
|
||||
-l|--level)
|
||||
COMPREPLY=( $(compgen -W "1 2 3 4 5 6 7 8 9" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
--kdf)
|
||||
COMPREPLY=( $(compgen -W "argon2id pbkdf2" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
-t|--threads)
|
||||
COMPREPLY=( $(compgen -W "0 1 2 4 8 16 32" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
-b|--block)
|
||||
COMPREPLY=( $(compgen -W "65536 131072 262144 524288 1048576" -- "$cur") )
|
||||
return 0
|
||||
;;
|
||||
-o|--output)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
--pq|--pq-sdk)
|
||||
# Key files (no extension constraint)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
--comment-file)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
-c|--comment)
|
||||
# Free-form text; no useful completion
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
;;
|
||||
-k)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$subcmd" in
|
||||
compress|c)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W "
|
||||
-l --level -b --block -s --store -f --fast
|
||||
--vv --vaptvupt --lzhp
|
||||
-p --password --kdf
|
||||
-c --comment --comment-file
|
||||
--pq --pq-sdk
|
||||
--dedup -D --solid
|
||||
-v --verbose -q --quiet -t --threads
|
||||
$global_opts
|
||||
" -- "$cur") )
|
||||
else
|
||||
_filedir
|
||||
fi
|
||||
;;
|
||||
extract|x)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W "
|
||||
-o --output -p --password
|
||||
--pq --pq-sdk
|
||||
-v --verbose -t --threads
|
||||
$global_opts
|
||||
" -- "$cur") )
|
||||
else
|
||||
_filedir 'zupt'
|
||||
fi
|
||||
;;
|
||||
list|l|test|t)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W "
|
||||
-p --password --pq --pq-sdk
|
||||
-v --verbose
|
||||
$global_opts
|
||||
" -- "$cur") )
|
||||
else
|
||||
_filedir 'zupt'
|
||||
fi
|
||||
;;
|
||||
info)
|
||||
_filedir 'zupt'
|
||||
;;
|
||||
disk)
|
||||
if [ "$cword" -eq 2 ]; then
|
||||
COMPREPLY=( $(compgen -W "backup restore" -- "$cur") )
|
||||
elif [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W "
|
||||
-p --password --pq --pq-sdk
|
||||
--kdf -c --comment --comment-file
|
||||
-v --verbose
|
||||
" -- "$cur") )
|
||||
else
|
||||
_filedir
|
||||
fi
|
||||
;;
|
||||
keygen)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--sdk --pq-sdk -o --pub -k" -- "$cur") )
|
||||
else
|
||||
_filedir
|
||||
fi
|
||||
;;
|
||||
bench)
|
||||
_filedir
|
||||
;;
|
||||
version|help)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _vaptvupt vaptvupt
|
||||
# v3.0.0: legacy `zupt` name retained as an alias.
|
||||
complete -F _vaptvupt zupt
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
# Fish completions for zupt
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) 2025-2026 Cristian Cezar Moisés
|
||||
#
|
||||
# Install:
|
||||
# sudo install -m 644 completions/zupt.fish /usr/share/fish/vendor_completions.d/
|
||||
# or for a single user:
|
||||
# cp completions/zupt.fish ~/.config/fish/completions/
|
||||
|
||||
# ─── Subcommands ───
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'compress c' -d 'Create an archive'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'compress c' -d 'Create an archive'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'extract x' -d 'Extract an archive'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'extract x' -d 'Extract an archive'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'list l' -d 'List archive entries'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'list l' -d 'List archive entries'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'test t' -d 'Verify archive integrity'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'test t' -d 'Verify archive integrity'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'info' -d 'Archive metadata (no key needed)'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'info' -d 'Archive metadata (no key needed)'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'bench' -d 'Benchmark compression levels'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'bench' -d 'Benchmark compression levels'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'disk' -d 'Full-disk backup/restore'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'disk' -d 'Full-disk backup/restore'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'keygen' -d 'Generate a key file'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'keygen' -d 'Generate a key file'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'version' -d 'Print version info'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'version' -d 'Print version info'
|
||||
complete -c vaptvupt -f -n '__fish_use_subcommand' -a 'help' -d 'Print help'
|
||||
complete -c zupt -f -n '__fish_use_subcommand' -a 'help' -d 'Print help'
|
||||
|
||||
# Helper predicates
|
||||
function __fish_zupt_using_subcommand
|
||||
set -l cmd (commandline -opc)
|
||||
if test (count $cmd) -gt 1
|
||||
contains -- $cmd[2] $argv
|
||||
return $status
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
# ─── Compress options ───
|
||||
set -l compress_cmds compress c
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s l -l level -d 'Compression level (1-9, default 7)' -x -a '1 2 3 4 5 6 7 8 9'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s l -l level -d 'Compression level (1-9, default 7)' -x -a '1 2 3 4 5 6 7 8 9'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s b -l block -d 'Block size in bytes' -x
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s b -l block -d 'Block size in bytes' -x
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s s -l store -d 'Store without compression'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s s -l store -d 'Store without compression'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s f -l fast -d 'Use fast LZ codec'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s f -l fast -d 'Use fast LZ codec'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -l vv -l vaptvupt -d 'Use VaptVupt codec'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -l vv -l vaptvupt -d 'Use VaptVupt codec'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -l lzhp -d 'Use Zupt-LZHP codec (no SIMD needed)'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -l lzhp -d 'Use Zupt-LZHP codec (no SIMD needed)'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s p -l password -d 'Encrypt with password (prompted if empty)' -x
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s p -l password -d 'Encrypt with password (prompted if empty)' -x
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -l kdf -d 'Password KDF' -x -a 'argon2id pbkdf2'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -l kdf -d 'Password KDF' -x -a 'argon2id pbkdf2'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s c -l comment -d 'Embed archive comment (UTF-8, ≤4096 B)' -x
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s c -l comment -d 'Embed archive comment (UTF-8, ≤4096 B)' -x
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -l comment-file -d 'Read comment from file' -r
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -l comment-file -d 'Read comment from file' -r
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -l pq -d 'Legacy PQ public key' -r
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -l pq -d 'Legacy PQ public key' -r
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -l pq-sdk -d 'PQ public key (libzuptsdk)' -r
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -l pq-sdk -d 'PQ public key (libzuptsdk)' -r
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s D -l dedup -d 'Block-level deduplication'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s D -l dedup -d 'Block-level deduplication'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -l solid -d 'Solid mode (single stream)'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -l solid -d 'Solid mode (single stream)'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s v -l verbose -d 'Verbose output'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s v -l verbose -d 'Verbose output'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s q -l quiet -d 'Suppress non-error output'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s q -l quiet -d 'Suppress non-error output'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $compress_cmds" -s t -l threads -d 'Thread count (0=auto)' -x
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $compress_cmds" -s t -l threads -d 'Thread count (0=auto)' -x
|
||||
|
||||
# ─── Extract / List / Test options ───
|
||||
set -l rw_cmds extract x list l test t
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $rw_cmds" -s o -l output -d 'Output directory' -x -a '(__fish_complete_directories)'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $rw_cmds" -s o -l output -d 'Output directory' -x -a '(__fish_complete_directories)'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $rw_cmds" -s p -l password -d 'Decryption password' -x
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $rw_cmds" -s p -l password -d 'Decryption password' -x
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $rw_cmds" -l pq -d 'Legacy PQ private key' -r
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $rw_cmds" -l pq -d 'Legacy PQ private key' -r
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $rw_cmds" -l pq-sdk -d 'PQ private key (libzuptsdk)' -r
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $rw_cmds" -l pq-sdk -d 'PQ private key (libzuptsdk)' -r
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $rw_cmds" -s v -l verbose -d 'Verbose output (surfaces top-MAC/SDK details on failure)'
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $rw_cmds" -s v -l verbose -d 'Verbose output (surfaces top-MAC/SDK details on failure)'
|
||||
complete -c vaptvupt -n "__fish_zupt_using_subcommand $rw_cmds" -s t -l threads -d 'Thread count' -x
|
||||
complete -c zupt -n "__fish_zupt_using_subcommand $rw_cmds" -s t -l threads -d 'Thread count' -x
|
||||
|
||||
# ─── Disk subcommand ───
|
||||
complete -c vaptvupt -f -n "__fish_zupt_using_subcommand disk; and not __fish_seen_subcommand_from backup restore" \
|
||||
complete -c zupt -f -n "__fish_zupt_using_subcommand disk; and not __fish_seen_subcommand_from backup restore" \
|
||||
-a 'backup' -d 'Read a block device into an archive'
|
||||
complete -c vaptvupt -f -n "__fish_zupt_using_subcommand disk; and not __fish_seen_subcommand_from backup restore" \
|
||||
complete -c zupt -f -n "__fish_zupt_using_subcommand disk; and not __fish_seen_subcommand_from backup restore" \
|
||||
-a 'restore' -d 'Write an archive to a block device'
|
||||
|
||||
# ─── Keygen options ───
|
||||
complete -c vaptvupt -n '__fish_zupt_using_subcommand keygen' -l sdk -d 'Generate SDK v2 keypair'
|
||||
complete -c zupt -n '__fish_zupt_using_subcommand keygen' -l sdk -d 'Generate SDK v2 keypair'
|
||||
complete -c vaptvupt -n '__fish_zupt_using_subcommand keygen' -l pq-sdk -d 'Same as --sdk'
|
||||
complete -c zupt -n '__fish_zupt_using_subcommand keygen' -l pq-sdk -d 'Same as --sdk'
|
||||
complete -c vaptvupt -n '__fish_zupt_using_subcommand keygen' -s o -d 'Output keyfile path' -r
|
||||
complete -c zupt -n '__fish_zupt_using_subcommand keygen' -s o -d 'Output keyfile path' -r
|
||||
complete -c vaptvupt -n '__fish_zupt_using_subcommand keygen' -l pub -d 'Export public key from -k'
|
||||
complete -c zupt -n '__fish_zupt_using_subcommand keygen' -l pub -d 'Export public key from -k'
|
||||
complete -c vaptvupt -n '__fish_zupt_using_subcommand keygen' -s k -d 'Source private keyfile' -r
|
||||
complete -c zupt -n '__fish_zupt_using_subcommand keygen' -s k -d 'Source private keyfile' -r
|
||||
112
completions/zupt.bash
Normal file
112
completions/zupt.bash
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
# bash completion for ZUPT
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
_zupt()
|
||||
{
|
||||
local cur prev command disk_command
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
command=${COMP_WORDS[1]-}
|
||||
disk_command=${COMP_WORDS[2]-}
|
||||
|
||||
case $prev in
|
||||
-l|--level)
|
||||
COMPREPLY=( $(compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur") )
|
||||
return
|
||||
;;
|
||||
-b|--block|-t|--threads|--pass-fd|-p|--password|-c|--comment)
|
||||
return
|
||||
;;
|
||||
--kdf)
|
||||
COMPREPLY=( $(compgen -W 'pbkdf2 argon2id' -- "$cur") )
|
||||
return
|
||||
;;
|
||||
-o|--output|-k|--key|--pass-file|--comment-file|--pq|--pq-only|--pq-sdk|--pq-box)
|
||||
COMPREPLY=( $(compgen -f -- "$cur") )
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( COMP_CWORD == 1 )); then
|
||||
COMPREPLY=( $(compgen -W \
|
||||
'compress c extract x list l test t info i bench b disk keygen version help --version -V --help -h' \
|
||||
-- "$cur") )
|
||||
return
|
||||
fi
|
||||
|
||||
local password_options='-p --password --password-prompt --pass-file --pass-fd'
|
||||
local pq_options='--pq --pq-only --pq-sdk --pq-box'
|
||||
local legacy_read_option='--allow-legacy-no-ait'
|
||||
local common_read_options="-v --verbose $password_options $pq_options $legacy_read_option"
|
||||
|
||||
case $command in
|
||||
compress|c)
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W \
|
||||
"-l --level -b --block -s --store -f --fast --vv --vaptvupt --lzhp
|
||||
$password_options --kdf -c --comment --comment-file $pq_options
|
||||
-D --dedup -S --solid -y --force -v --verbose -t --threads" \
|
||||
-- "$cur") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -f -- "$cur") )
|
||||
fi
|
||||
;;
|
||||
extract|x)
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W \
|
||||
"-o --output $common_read_options -t --threads" -- "$cur") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -f -X '!*.zupt' -- "$cur") )
|
||||
fi
|
||||
;;
|
||||
list|l|test|t)
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W "$common_read_options" -- "$cur") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -f -X '!*.zupt' -- "$cur") )
|
||||
fi
|
||||
;;
|
||||
info|i)
|
||||
COMPREPLY=( $(compgen -f -X '!*.zupt' -- "$cur") )
|
||||
;;
|
||||
bench|b)
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '--compare' -- "$cur") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -f -- "$cur") )
|
||||
fi
|
||||
;;
|
||||
disk)
|
||||
if (( COMP_CWORD == 2 )); then
|
||||
COMPREPLY=( $(compgen -W 'backup restore' -- "$cur") )
|
||||
elif [[ $cur == -* ]]; then
|
||||
local disk_options
|
||||
disk_options="-l --level -b --block -s --store --vv --vaptvupt --lzhp
|
||||
$password_options --kdf -c --comment --comment-file
|
||||
--pq --pq-only -D --dedup -v --verbose -t --threads"
|
||||
if [[ $disk_command == restore ]]; then
|
||||
disk_options+=" $legacy_read_option"
|
||||
fi
|
||||
COMPREPLY=( $(compgen -W \
|
||||
"$disk_options" \
|
||||
-- "$cur") )
|
||||
elif [[ $disk_command == restore ]]; then
|
||||
COMPREPLY=( $(compgen -f -X '!*.zupt' -- "$cur") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -f -- "$cur") )
|
||||
fi
|
||||
;;
|
||||
keygen)
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W \
|
||||
'-o --output --pub -k --key --pq-only --pqonly --sdk --pq-sdk --box --pq-box' \
|
||||
-- "$cur") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -f -- "$cur") )
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _zupt zupt
|
||||
163
completions/zupt.fish
Normal file
163
completions/zupt.fish
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
# fish completion for ZUPT
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
function __fish_zupt_needs_command
|
||||
set -l tokens (commandline -opc)
|
||||
test (count $tokens) -eq 1
|
||||
end
|
||||
|
||||
function __fish_zupt_using_command
|
||||
set -l tokens (commandline -opc)
|
||||
test (count $tokens) -gt 1; and contains -- $tokens[2] $argv
|
||||
end
|
||||
|
||||
function __fish_zupt_disk_needs_command
|
||||
set -l tokens (commandline -opc)
|
||||
test (count $tokens) -eq 2; and test "$tokens[2]" = disk
|
||||
end
|
||||
|
||||
function __fish_zupt_disk_using_command
|
||||
set -l tokens (commandline -opc)
|
||||
test (count $tokens) -gt 2; and test "$tokens[2]" = disk; and contains -- $tokens[3] $argv
|
||||
end
|
||||
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a 'compress c' -d 'Create an archive'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a 'extract x' -d 'Extract an archive'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a 'list l' -d 'List archive entries'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a 'test t' -d 'Verify archive integrity'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a 'info i' -d 'Show archive framing metadata'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a 'bench b' -d 'Benchmark compression levels'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a disk -d 'Back up or restore a disk image'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a keygen -d 'Generate or export a recipient key'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a version -d 'Show version and build information'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a help -d 'Show command help'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a '--version -V' -d 'Show version and build information'
|
||||
complete -c zupt -f -n __fish_zupt_needs_command \
|
||||
-a '--help -h' -d 'Show command help'
|
||||
|
||||
set -l compress_condition '__fish_zupt_using_command compress c'
|
||||
complete -c zupt -n "$compress_condition" -s l -l level \
|
||||
-d 'Compression level' -x -a '1 2 3 4 5 6 7 8 9'
|
||||
complete -c zupt -n "$compress_condition" -s b -l block \
|
||||
-d 'Block size in bytes' -x
|
||||
complete -c zupt -n "$compress_condition" -s s -l store \
|
||||
-d 'Store without compression'
|
||||
complete -c zupt -n "$compress_condition" -s f -l fast \
|
||||
-d 'Use fast LZ codec'
|
||||
complete -c zupt -n "$compress_condition" -l vv -l vaptvupt \
|
||||
-d 'Force VaptVupt LZ + ANS codec'
|
||||
complete -c zupt -n "$compress_condition" -l lzhp \
|
||||
-d 'Force portable LZHP codec'
|
||||
complete -c zupt -n "$compress_condition" -l kdf \
|
||||
-d 'Password KDF' -x -a 'pbkdf2 argon2id'
|
||||
complete -c zupt -n "$compress_condition" -s c -l comment \
|
||||
-d 'Store an archive comment' -x
|
||||
complete -c zupt -n "$compress_condition" -l comment-file \
|
||||
-d 'Read archive comment from file' -r
|
||||
complete -c zupt -n "$compress_condition" -s D -l dedup \
|
||||
-d 'Enable block-level deduplication'
|
||||
complete -c zupt -n "$compress_condition" -s S -l solid \
|
||||
-d 'Use a solid single compression stream'
|
||||
complete -c zupt -n "$compress_condition" -s y -l force \
|
||||
-d 'Overwrite an existing non-.zupt output'
|
||||
complete -c zupt -n "$compress_condition" -s t -l threads \
|
||||
-d 'Compression thread count' -x
|
||||
|
||||
set -l read_condition '__fish_zupt_using_command compress c extract x list l test t'
|
||||
complete -c zupt -n "$read_condition" -s p -l password \
|
||||
-d 'Password in process arguments' -x
|
||||
complete -c zupt -n "$read_condition" -l password-prompt \
|
||||
-d 'Read password interactively without echo'
|
||||
complete -c zupt -n "$read_condition" -l pass-file \
|
||||
-d 'Read password from first line of file' -r
|
||||
complete -c zupt -n "$read_condition" -l pass-fd \
|
||||
-d 'Read password from inherited file descriptor' -x
|
||||
complete -c zupt -n "$read_condition" -l pq \
|
||||
-d 'Native ML-KEM-768 + X25519 hybrid key' -r
|
||||
complete -c zupt -n "$read_condition" -l pq-only \
|
||||
-d 'Native ML-KEM-768-only key' -r
|
||||
complete -c zupt -n "$read_condition" -l pq-sdk \
|
||||
-d 'Optional system libvuptsdk key' -r
|
||||
complete -c zupt -n "$read_condition" -l pq-box \
|
||||
-d 'Optional system libpqvaptvupt key' -r
|
||||
complete -c zupt -n "$read_condition" -s v -l verbose \
|
||||
-d 'Additional progress or diagnostic output'
|
||||
|
||||
set -l legacy_read_condition '__fish_zupt_using_command extract x list l test t'
|
||||
complete -c zupt -n "$legacy_read_condition" -l allow-legacy-no-ait \
|
||||
-d 'Recover a trusted old archive without an integrity trailer'
|
||||
|
||||
complete -c zupt -n '__fish_zupt_using_command extract x' \
|
||||
-s o -l output -d 'Output directory' -r
|
||||
complete -c zupt -n '__fish_zupt_using_command extract x' \
|
||||
-s t -l threads -d 'Decompression thread count' -x
|
||||
complete -c zupt -n '__fish_zupt_using_command bench b' \
|
||||
-l compare -d 'Compare available external compressors'
|
||||
|
||||
complete -c zupt -f -n __fish_zupt_disk_needs_command \
|
||||
-a backup -d 'Create a disk-image archive'
|
||||
complete -c zupt -f -n __fish_zupt_disk_needs_command \
|
||||
-a restore -d 'Restore a disk-image archive'
|
||||
set -l disk_condition '__fish_zupt_using_command disk'
|
||||
complete -c zupt -n "$disk_condition" -s l -l level \
|
||||
-d 'Compression level' -x -a '1 2 3 4 5 6 7 8 9'
|
||||
complete -c zupt -n "$disk_condition" -s b -l block \
|
||||
-d 'Block size in bytes' -x
|
||||
complete -c zupt -n "$disk_condition" -s s -l store \
|
||||
-d 'Store without compression'
|
||||
complete -c zupt -n "$disk_condition" -l vv -l vaptvupt \
|
||||
-d 'Force VaptVupt LZ + ANS codec'
|
||||
complete -c zupt -n "$disk_condition" -l lzhp \
|
||||
-d 'Force portable LZHP codec'
|
||||
complete -c zupt -n "$disk_condition" -s p -l password \
|
||||
-d 'Password in process arguments' -x
|
||||
complete -c zupt -n "$disk_condition" -l password-prompt \
|
||||
-d 'Read password interactively without echo'
|
||||
complete -c zupt -n "$disk_condition" -l pass-file \
|
||||
-d 'Read password from first line of file' -r
|
||||
complete -c zupt -n "$disk_condition" -l pass-fd \
|
||||
-d 'Read password from inherited file descriptor' -x
|
||||
complete -c zupt -n "$disk_condition" -l kdf \
|
||||
-d 'Password KDF' -x -a 'pbkdf2 argon2id'
|
||||
complete -c zupt -n "$disk_condition" -s c -l comment \
|
||||
-d 'Store an archive comment' -x
|
||||
complete -c zupt -n "$disk_condition" -l comment-file \
|
||||
-d 'Read archive comment from file' -r
|
||||
complete -c zupt -n "$disk_condition" -l pq \
|
||||
-d 'Native ML-KEM-768 + X25519 hybrid key' -r
|
||||
complete -c zupt -n "$disk_condition" -l pq-only \
|
||||
-d 'Native ML-KEM-768-only key' -r
|
||||
complete -c zupt -n "$disk_condition" -s D -l dedup \
|
||||
-d 'Enable block-level deduplication'
|
||||
complete -c zupt -n "$disk_condition" -s v -l verbose \
|
||||
-d 'Additional progress or diagnostic output'
|
||||
complete -c zupt -n "$disk_condition" -s t -l threads \
|
||||
-d 'Thread count' -x
|
||||
complete -c zupt -n '__fish_zupt_disk_using_command restore' \
|
||||
-l allow-legacy-no-ait \
|
||||
-d 'Recover a trusted old disk archive without an integrity trailer'
|
||||
|
||||
set -l keygen_condition '__fish_zupt_using_command keygen'
|
||||
complete -c zupt -n "$keygen_condition" -s o -l output \
|
||||
-d 'Output key file' -r
|
||||
complete -c zupt -n "$keygen_condition" -l pub \
|
||||
-d 'Export a public key'
|
||||
complete -c zupt -n "$keygen_condition" -s k -l key \
|
||||
-d 'Source private key' -r
|
||||
complete -c zupt -n "$keygen_condition" -l pq-only -l pqonly \
|
||||
-d 'Native ML-KEM-768-only key format'
|
||||
complete -c zupt -n "$keygen_condition" -l sdk -l pq-sdk \
|
||||
-d 'Optional system libvuptsdk key format'
|
||||
complete -c zupt -n "$keygen_condition" -l box -l pq-box \
|
||||
-d 'Optional system libpqvaptvupt key format'
|
||||
Loading…
Reference in a new issue