From 2a9aa61cee1c350d20b96058aac5e7c8d437a867 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Thu, 10 Mar 2016 16:45:41 +0100 Subject: [PATCH] version 0.9 revert $JO_PRETTY --- ChangeLog | 3 +++ configure.ac | 2 +- jo.1 | 17 ----------------- jo.c | 9 +-------- jo.md | 21 ++------------------- jo.pandoc | 13 +------------ tests/jo.01.in | 2 +- tests/jo.02.in | 2 +- tests/jo.03.in | 2 +- tests/jo.04.in | 2 +- tests/jo.05.in | 2 +- tests/jo.test | 2 +- 12 files changed, 14 insertions(+), 63 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12bdb77..24d4e28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ +2016-03-10 0.9 +- UPD: revert support for $JO_PRETTY et. al; it was a bad idea + 2016-03-10 0.8 - UPD: new test suite - NEW: support for nested elements (#19) diff --git a/configure.ac b/configure.ac index 47c8313..07aa9f8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([jo], [0.8], [jpmens@gmail.com]) +AC_INIT([jo], [0.9], [jpmens@gmail.com]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([jo.c]) diff --git a/jo.1 b/jo.1 index 9c908bb..cd8b772 100644 --- a/jo.1 +++ b/jo.1 @@ -140,7 +140,6 @@ Disable with this option. .B \-p Pretty\-print the JSON string on output instead of the terse one\-line output it prints by default. -(See \f[C]$JO_PRETTY\f[] and \f[C]$JO_SPACER\f[] below.) .RS .RE .TP @@ -153,22 +152,6 @@ Show version and exit. Show version as a JSON object and exit. .RS .RE -.SH ENVIRONMENT -.PP -\f[I]jo\f[] attempts to use the following variables from its -environment: -.TP -.B JO_PRETTY -If this variable is set to any value, \f[I]jo\f[] will pretty\-print on -output without having to specify \f[C]\-p\f[]. -.RS -.RE -.TP -.B JO_SPACER -When pretty\-printing, \f[I]jo\f[] uses three spaces by default. -Set this variable to any number of spaces or tabs to use instead. -.RS -.RE .SH BUGS .PP Probably. diff --git a/jo.c b/jo.c index 40795b9..819baf0 100644 --- a/jo.c +++ b/jo.c @@ -333,15 +333,8 @@ char* locale_from_utf8(const char *utf8, size_t len) char *stringify(JsonNode *json, int flags) { int pretty = flags & FLAG_PRETTY; - char *p, *spacer; - if ((p = getenv("JO_PRETTY")) != NULL) - pretty = TRUE; - - if ((spacer = getenv("JO_SPACER")) == NULL) - spacer = SPACER; - - return json_stringify(json, (pretty) ? spacer : NULL); + return json_stringify(json, (pretty) ? SPACER : NULL); } int version(int flags) diff --git a/jo.md b/jo.md index 2632e71..758fd60 100644 --- a/jo.md +++ b/jo.md @@ -1,7 +1,3 @@ ---- -title: 'JO(1) User Manuals' -... - NAME ==== @@ -119,8 +115,7 @@ OPTIONS -p : Pretty-print the JSON string on output instead of the terse one-line - output it prints by default. (See `$JO_PRETTY` and `$JO_SPACER` - below.) + output it prints by default. -v : Show version and exit. @@ -128,19 +123,6 @@ OPTIONS -V : Show version as a JSON object and exit. -ENVIRONMENT -=========== - -*jo* attempts to use the following variables from its environment: - -JO\_PRETTY -: If this variable is set to any value, *jo* will pretty-print on - output without having to specify `-p`. - -JO\_SPACER -: When pretty-printing, *jo* uses three spaces by default. Set this - variable to any number of spaces or tabs to use instead. - BUGS ==== @@ -190,3 +172,4 @@ AUTHOR ====== Jan-Piet Mens + diff --git a/jo.pandoc b/jo.pandoc index 729b5e8..20f417a 100644 --- a/jo.pandoc +++ b/jo.pandoc @@ -102,7 +102,7 @@ Elements (objects and arrays) can be nested. The following example nests an arra -p : Pretty-print the JSON string on output instead of the terse one-line output it - prints by default. (See `$JO_PRETTY` and `$JO_SPACER` below.) + prints by default. -v : Show version and exit. @@ -110,17 +110,6 @@ Elements (objects and arrays) can be nested. The following example nests an arra -V : Show version as a JSON object and exit. -# ENVIRONMENT - -*jo* attempts to use the following variables from its environment: - -JO_PRETTY -: If this variable is set to any value, *jo* will pretty-print on output without having to specify `-p`. - - -JO_SPACER -: When pretty-printing, *jo* uses three spaces by default. Set this variable to any number of spaces or tabs to use instead. - # BUGS Probably. diff --git a/tests/jo.01.in b/tests/jo.01.in index fa794a8..717a9d8 100644 --- a/tests/jo.01.in +++ b/tests/jo.01.in @@ -1,2 +1,2 @@ # basic logo -unset JO_PRETTY; $JOBIN -a jo +$JOBIN -a jo diff --git a/tests/jo.02.in b/tests/jo.02.in index 956098a..7cdee44 100644 --- a/tests/jo.02.in +++ b/tests/jo.02.in @@ -1,2 +1,2 @@ # basic logo (stdin) -unset JO_PRETTY; (echo jo | $JOBIN -a) +echo jo | $JOBIN -a diff --git a/tests/jo.03.in b/tests/jo.03.in index ec66914..1ee7a04 100644 --- a/tests/jo.03.in +++ b/tests/jo.03.in @@ -1,2 +1,2 @@ # basic two values -unset JO_PRETTY; $JOBIN pass=true type=text +$JOBIN pass=true type=text diff --git a/tests/jo.04.in b/tests/jo.04.in index 2683984..61c893f 100644 --- a/tests/jo.04.in +++ b/tests/jo.04.in @@ -1,5 +1,5 @@ # nested with executable -unset JO_PRETTY; $JOBIN name="Jane Jolie" data="$($JOBIN age= country=ES)" +$JOBIN name="Jane Jolie" data="$($JOBIN age= country=ES)" # the double quotes around data are required for OpenBSD 5.8 # which mucks up the input with its pdksh otherwise diff --git a/tests/jo.05.in b/tests/jo.05.in index 9b6f64c..89238ac 100644 --- a/tests/jo.05.in +++ b/tests/jo.05.in @@ -1,2 +1,2 @@ # nested native -unset JO_PRETTY; $JOBIN a[]=1 a[]=2 geo[lat]=111 geo[lon]=222 +$JOBIN a[]=1 a[]=2 geo[lat]=111 geo[lon]=222 diff --git a/tests/jo.test b/tests/jo.test index 2182ce2..8ab11b9 100755 --- a/tests/jo.test +++ b/tests/jo.test @@ -4,7 +4,7 @@ # be a comment and is used as the name of the test: # # # basic logo -# unset JO_PRETTY; $JOBIN -a jo +# $JOBIN -a jo # # the expect file (jo.??.exp) is a file which will be diff'd # against the output of the corresponding .in file: