function pack if test (count $argv) -lt 2 echo "Usage: pack [more files...]" return 1 end if not command -q tar echo "pack: 'tar' is not installed. Install it via your package manager." return 1 end set archive $argv[1] set targets $argv[2..-1] if not string match -q '*.tar.xz' -- $archive set archive "$archive.tar.xz" end tar -cJvf $archive $targets end