Skip to content

Instantly share code, notes, and snippets.

@ejmr
Created October 19, 2015 04:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejmr/3c8e84c251291b3d63a3 to your computer and use it in GitHub Desktop.
Save ejmr/3c8e84c251291b3d63a3 to your computer and use it in GitHub Desktop.
Fish Shell Script to Help Search for Error Messages Online
# 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