1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-26 09:07:12 -07:00

reformat archive scripts to better fit in

This commit is contained in:
Connor Olding 2021-09-28 13:41:55 -07:00
parent bf684554e6
commit bd81dc0b28
3 changed files with 215 additions and 195 deletions

View File

@ -1,3 +1,10 @@
#!/usr/bin/env zsh
# YES_ZSH
# NO_BASH
# NO_DASH
# NO_ASH
archive() {
#
# Creates archive file
#
@ -5,8 +12,6 @@
# Matt Hamilton <m@tthamilton.com>
#
# function archive {
local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin _zstd_bin
if (( $# < 2 )); then
@ -71,5 +76,6 @@ case "${archive_name}" in
(*.lzma) print "\n.lzma is only useful for single files, and does not capture permissions. Use .tar.lzma" ;;
(*) print "\nunknown archive type for archive: ${archive_name}" ;;
esac
}
# }
[ -n "${preload+-}" ] || archive "$@"

View File

@ -1,3 +1,10 @@
#!/usr/bin/env zsh
# YES_ZSH
# NO_BASH
# NO_DASH
# NO_ASH
lsarchive() {
#
# Lists the contents of archives.
#
@ -5,8 +12,6 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# function lsarchive {
local verbose
if (( $# == 0 )); then
@ -18,6 +23,7 @@ options:
Report bugs to <sorin.ionescu@gmail.com>.
EOF
return 1
fi
if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
@ -58,5 +64,6 @@ while (( $# > 0 )); do
shift
done
}
# }
[ -n "${preload+-}" ] || lsarchive "$@"

View File

@ -1,3 +1,10 @@
#!/usr/bin/env zsh
# YES_ZSH
# NO_BASH
# NO_DASH
# NO_ASH
unarchive() {
#
# Extracts the contents of archives.
#
@ -5,8 +12,6 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# function unarchive {
local remove_archive
local success
local file_name
@ -23,6 +28,7 @@ options:
Report bugs to <sorin.ionescu@gmail.com>.
EOF
return 1
fi
remove_archive=1
@ -107,5 +113,6 @@ while (( $# > 0 )); do
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
shift
done
}
# }
[ -n "${preload+-}" ] || unarchive "$@"