Skip to content

Instantly share code, notes, and snippets.

@scateu
Last active September 13, 2021 04:19
Show Gist options
  • Save scateu/6ceb04c2f107924d58374bb962cdcf76 to your computer and use it in GitHub Desktop.
Save scateu/6ceb04c2f107924d58374bb962cdcf76 to your computer and use it in GitHub Desktop.
pbpaste.workflow
# Open "Automator.app", add a new "Quick Action"
# Workflow receives current "files or folders" in "Finder"
#+ Run Shell Script
#+ Shell: /bin/bash
#+ Pass input: as arguments
# Deployment: Keyboard / Shortcuts, bind 'Cmd-Shift-V'
# Usage: copy something to clipboard, click on a folder, press 'Cmd-Shift-V'.
# Contents will be pasted into 'pbpaste.txt'.
# Should a 'pbpaste.txt' exists, new contents will be appended with dashes.
export LANG=en_US.UTF-8
if [[ -d "$@" ]]; then
cd "$@"
if [ -f pbpaste.txt ]; then
echo >> pbpaste.txt
echo "--------------------" >> pbpaste.txt
echo >> pbpaste.txt
fi
pbpaste >> pbpaste.txt
elif [[ -f "$@" ]]; then
echo >> "$@"
echo >> "$@"
echo "--------------------" >> "$@"
echo >> "$@"
pbpaste >> "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment