Skip to content

Instantly share code, notes, and snippets.

@ywatase
Last active December 21, 2015 17:29
Show Gist options
  • Save ywatase/6340634 to your computer and use it in GitHub Desktop.
Save ywatase/6340634 to your computer and use it in GitHub Desktop.
diff --git a/builtin.c b/builtin.c
index 071cb56..a8a8780 100644
--- a/builtin.c
+++ b/builtin.c
@@ -560,7 +560,7 @@ static const char* const jq_builtins[] = {
"def _modify(paths; update): reduce path(paths) as $p (.; setpath($p; getpath($p) | update));",
"def recurse(f): ., (f | select(. != null) | recurse(f));",
"def to_entries: [keys[] as $k | {key: $k, value: .[$k]}];",
- "def from_entries: map({(.key): .value}) | add;",
+ "def from_entries: map({(.key//.Key): (.value//.Value)}) | add;",
"def with_entries(f): to_entries | map(f) | from_entries;",
"def reverse: [.[length - 1 - range(0;length)]];",
};
require 'formula'
class Jq < Formula
homepage 'http://stedolan.github.io/jq/'
url 'http://stedolan.github.io/jq/download/source/jq-1.3.tar.gz'
sha1 'ac1f19e5d9921683af25251e97c2c4bfee895ca2'
head 'https://github.com/stedolan/jq.git'
def install
system "./configure"
system "make"
bin.install 'jq'
man1.install 'jq.1'
end
def patches
"https://gist.github.com/ywatase/6340634/raw/jq-1.3-from_entries.patch"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment