17 lines
365 B
Fish
Executable File
17 lines
365 B
Fish
Executable File
function pack
|
|
if test (count $argv) -lt 2
|
|
echo "Usage: pack <archive-name> <file-or-dir> [more files...]"
|
|
return 1
|
|
end
|
|
|
|
set archive $argv[1]
|
|
set targets $argv[2..-1]
|
|
|
|
# Ensure .tar.xz extension
|
|
if not string match -r '\.tar\.xz$' -- $archive
|
|
set archive "$archive.tar.xz"
|
|
end
|
|
|
|
tar -cJvf $archive $targets
|
|
end
|