File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -96,11 +96,18 @@ var stateColors = function (states)
9696
9797var addTag = function ( config , datum )
9898{
99+ var payload , tag ;
100+
99101 if ( ! datum . json )
100102 fatal ( 'tag missing json: >>>%s<<<' , dump ( datum ) ) ;
101103
102- var payload = JSON . parse ( datum . json ) ;
103- var tag = payload . tag ;
104+ try {
105+ payload = JSON . parse ( datum . json ) ;
106+ } catch ( err ) {
107+ fatal ( 'tag payload failed to parse: >>>>%s<<<' , datum . json ) ;
108+ }
109+
110+ tag = payload . tag ;
104111
105112 if ( ! tag ) {
106113 if ( ! datum . hasOwnProperty ( 'name' ) ||
@@ -710,6 +717,10 @@ var main = function ()
710717 names : [ 'ignoreTags' , 'i' ] ,
711718 type : 'bool' ,
712719 help : 'ignore tags in input'
720+ } , {
721+ names : [ 'dry-run' , 'n' ] ,
722+ type : 'bool' ,
723+ help : 'ingest data, but do not generate output'
713724 } , {
714725 names : [ 'stateHeight' , 'h' ] ,
715726 type : 'number' ,
@@ -807,7 +818,9 @@ var main = function ()
807818 obj . data . push ( datum ) ;
808819 } , config ) ;
809820
810- statemap ( config , obj ) ;
821+ if ( ! opts . dry_run )
822+ statemap ( config , obj ) ;
823+
811824 process . exit ( 0 ) ;
812825 } ) ;
813826} ;
You can’t perform that action at this time.
0 commit comments