Created
October 19, 2015 04:12
-
-
Save ejmr/3c8e84c251291b3d63a3 to your computer and use it in GitHub Desktop.
Fish Shell Script to Help Search for Error Messages Online
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
# This function runs a command while copying standard error to a | |
# temporary file. If the command has a non-zero exit code then the | |
# function copies the last line of standard error to the clipboard. | |
# This makes it easy to switch over to my browser and do a search for | |
# that error message. | |
function run-cp-stderr --description="Run a command copying the tail of STDERR to the clipboard" | |
set --local ERROR_FILE (mktemp --suffix=".fish-command.log" --tmpdir="/tmp") | |
if not eval $argv ^$ERROR_FILE | |
tail --lines=1 "$ERROR_FILE" | xclip -in -selection "clipboard" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment