Skip to content

Instantly share code, notes, and snippets.

@satour
Last active December 2, 2016 13:50
Show Gist options
  • Save satour/8f8c2c61531960e846df117ebbadacaf to your computer and use it in GitHub Desktop.
Save satour/8f8c2c61531960e846df117ebbadacaf to your computer and use it in GitHub Desktop.
jq コマンドの出力結果を色つきでlessとして表示するやつ
if STDIN.tty?
file = ARGV[0]
filter = ARGV[1] || "."
system("cat " + file + "|jq " + filter + " -C |less")
else
filter = ARGV[0] || "."
system("jq " + filter + " -C |less")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment