Open
Description
I didn't realize the string manipulation was part of Fish, so this took me a bit to get partially working.
trim-right is deprecated, but changing it to string trim -c .zip
seems to work.
I do get a warning:
fish: Unknown command: is-clean-zip ~/.config/fish/functions/functions.fish (line 37): if is-clean-zip $zipfile
But everything still seems to work still, so I'm not sure what this bit was supposed to do!
Here's the code as I have it now.
# Clean unzip: Creates a top level folder if a zip file doesn't have one
# This prevents the directory from being cluttered with unzipped files
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 zipname (echo $zipfile | string trim -c .zip)
mkdir $zipname || return 1
unzip $zipfile -d $zipname
end
end
# unzip-cd utilizes clean-unzip to unzip and cd into a zip file
function unzip-cd --argument zipfile
clean-unzip $zipfile && cd (echo $zipfile | string trim -c .zip)
end
Metadata
Metadata
Assignees
Labels
No labels