From ea8b76569c6b226fe148e559477669b095408472 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 8 Nov 2015 12:43:02 +0100 Subject: JSON harder! --- push | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'push') diff --git a/push b/push index fc18882..8041472 100755 --- a/push +++ b/push @@ -20,10 +20,11 @@ my_hosts() { } all_push_hosts() { - echo '{' git remote -v \ - | sed -n 's/^\(\S\+\)\s\+git@\([^:]\+\):\(\S\+\) (push)$/"\1":{"host":"\2","repo":"\3"}/;T;$!s/$/,/;p' - echo '}' + | sed -n ' + s/^\(\S\+\)\s\+git@\([^:]\+\):\(\S\+\) (push)$/{"key":"\1","value":{"host":"\2","repo":"\3"}}/p + ' \ + | jq -s from_entries } my_push_hosts() { -- cgit v1.2.3