feat: add deb, pkgbuild, completion, code improvements
This commit is contained in:
11
src/completely.yaml
Normal file
11
src/completely.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
# See https://github.com/DannyBen/completely
|
||||
|
||||
boring_backup:
|
||||
- --help
|
||||
- --version
|
||||
- --verbose
|
||||
- --config
|
||||
- --log-file
|
||||
- --pid-file
|
||||
- --use-syslog
|
||||
- <file>
|
39
src/completion
Normal file
39
src/completion
Normal file
@ -0,0 +1,39 @@
|
||||
# boring_backup completion -*- shell-script -*-
|
||||
|
||||
# This bash completions script was generated by
|
||||
# completely (https://github.com/dannyben/completely)
|
||||
# Modifying it manually is not recommended
|
||||
|
||||
_boring_backup_completions_filter() {
|
||||
local words="$1"
|
||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||
local result=()
|
||||
|
||||
if [[ "${cur:0:1}" == "-" ]]; then
|
||||
echo "$words"
|
||||
|
||||
else
|
||||
for word in $words; do
|
||||
[[ "${word:0:1}" != "-" ]] && result+=("$word")
|
||||
done
|
||||
|
||||
echo "${result[*]}"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
_boring_backup_completions() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||
local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
|
||||
local compline="${compwords[*]}"
|
||||
|
||||
case "$compline" in
|
||||
*)
|
||||
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_boring_backup_completions_filter "--help --version --verbose --config --log-file --pid-file --use-syslog")" -- "$cur" )
|
||||
;;
|
||||
|
||||
esac
|
||||
} &&
|
||||
complete -F _boring_backup_completions boring_backup
|
||||
|
||||
# ex: filetype=sh
|
@ -35,7 +35,7 @@ process_source() {
|
||||
# ^^^ hide password from output ^^^
|
||||
|
||||
case "$scheme" in
|
||||
file) handler='src_tar';;
|
||||
file|sqlite) handler='src_tar';;
|
||||
mysql|mariadb) handler='src_mysqldump';;
|
||||
postgres) handler='src_pg_dump';;
|
||||
sqlite) handler='src_sqlite';;
|
||||
|
@ -36,7 +36,7 @@ src_tar() {
|
||||
parse_uri "$uri"
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
if [[ "$scheme" != 'file' ]]; then
|
||||
if [[ ! "$scheme" =~ ^(file|sqlite)$ ]]; then
|
||||
log -p "Error: Wrong URI scheme: $scheme" >&2; exit 1
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user