Skip to content

Instantly share code, notes, and snippets.

@factorin-j
Created November 21, 2018 03:22
Show Gist options
  • Save factorin-j/8bc09683c6f81e5b02b7951079e1ec68 to your computer and use it in GitHub Desktop.
Save factorin-j/8bc09683c6f81e5b02b7951079e1ec68 to your computer and use it in GitHub Desktop.
Diff command wrapper to add output color.
#!/usr/bin/env bash
diff -u $@ | sed "s/^-/`echo -e \"\x1b\"`[31m-/;s/^+/`echo -e \"\x1b\"`[32m+/;s/^@/`echo -e \"\x1b\"`[34m@/;s/$/`echo -e \"\x1b\"`[0m/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment