15 lines
432 B
Fish
15 lines
432 B
Fish
function clean-unzip --argument zipfile
|
|
if not test (echo $zipfile | string sub --start=-4) = .zip
|
|
echo (status function): argument must be a zipfile
|
|
return 1
|
|
end
|
|
|
|
if is-clean-zip $zipfile
|
|
unzip $zipfile
|
|
else
|
|
set folder_name (echo $zipfile | trim-right '.zip')
|
|
set target (basename $folder_name)
|
|
mkdir $target || return 1
|
|
unzip $zipfile -d $target
|
|
end
|
|
end
|