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:
parent
bf684554e6
commit
bd81dc0b28
12
sh/archive
12
sh/archive
|
@ -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 "$@"
|
||||
|
|
13
sh/lsarchive
13
sh/lsarchive
|
@ -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 "$@"
|
||||
|
|
13
sh/unarchive
13
sh/unarchive
|
@ -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 "$@"
|
||||
|
|
Loading…
Reference in New Issue
Block a user