add completion for bkp, add func destroy

This commit is contained in:
TheK4n 2022-04-20 21:57:31 +03:00
parent 350a359175
commit fbe1ac82f1
2 changed files with 20 additions and 0 deletions

View File

@ -7,6 +7,15 @@ _ssh() {
return 0
}
_bkp() {
local cur opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$(ls ~/.backup/1)
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
return 0
}
_workon() {
local cur prev envs
COMPREPLY=()
@ -20,4 +29,5 @@ _workon() {
complete -F _workon workon
complete -F _ssh ssh
complete -F _ssh sftp
complete -F _bkp bkp

View File

@ -1,4 +1,14 @@
destroy() {
test -n "$1" || return 1
test -e "$1" || return 1
echo "Sure want to destroy file '$1' with size $(du -hs "$1" | awk '{printf $1}') [y/N] "
read -r response
[[ $response == [yY] ]] && shred -zun 25 "$1"
}
lsl () {
local DIR