Skip to content

Instantly share code, notes, and snippets.

@jpmhouston
Created August 24, 2020 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpmhouston/4e23e60767055f98fccfee956eef9eda to your computer and use it in GitHub Desktop.
Save jpmhouston/4e23e60767055f98fccfee956eef9eda to your computer and use it in GitHub Desktop.
Fish shell function that outputs linefeed delimited paths of the finder selection
# Useful to refer to finder selections from the fish shell command line, like:
# $ file (selection)
# /Users/me/Documents/Files/Throwback.dvtcolortheme: XML 1.0 document text, ASCII text
# /Users/me/Documents/Files/Test.sparsebundle/: directory
#
function selection
osascript -e "tell application \"Finder\" to set s to the selection as alias list" -e "repeat with f in s" -e "set contents of f to POSIX path of f" -e "end repeat" -e "set AppleScript's text item delimiters to linefeed" -e "s as string"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment