Created
March 26, 2018 21:31
-
-
Save macielsmith/18452e710a6b226f81152e21b2610287 to your computer and use it in GitHub Desktop.
prettify json files in git project before comparing
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
#!/bin/zsh | |
git diff --name-only | egrep '(dg5|df5|json)$' | xargs ~/.bin/prettify.rb |
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
#!/usr/bin/env ruby | |
require "json" | |
filename = ARGV[0] | |
c = JSON.pretty_generate(JSON.parse(File.open(filename).read)) | |
File.open(filename, "w").write(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment