Created
April 25, 2024 10:54
-
-
Save chattr/2a2251e5fb2679768039c843138bbaca to your computer and use it in GitHub Desktop.
Useful shell functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# VSCode diff with ephemeral working directory and files | |
diffy() ( | |
# shellcheck disable=SC2317 | |
cleanup() { | |
rm -rf "${HOME}/sandbox" | |
} | |
trap cleanup EXIT | |
trap cleanup TERM | |
[ ! -d "${HOME}/sandbox" ] && mkdir "${HOME}/sandbox" | |
touch "${HOME}/sandbox/"{a,b} | |
code --wait --diff "${HOME}/sandbox/"{a,b} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment