feat: add deb, pkgbuild, completion, code improvements

This commit is contained in:
ge
2022-10-09 03:29:35 +03:00
parent 8999940443
commit ce07669a6e
11 changed files with 167 additions and 13 deletions

11
src/completely.yaml Normal file
View 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
View 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

View File

@ -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';;

View File

@ -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