From bb5b1e1d2bd5306b4dba8baf197f1fd15999ed1e Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 31 Oct 2022 20:23:05 +0100 Subject: [PATCH] keep valueless lines as is No padding or graph (from negative minimums). --- barcat | 4 ++++ t/t1005-float.out | 4 ++-- t/t1006-unvalued.in | 8 ++++++++ t/t1006-unvalued.out | 8 ++++++++ t/t1008-unicode.out | 2 +- t/t1301-field_grep_-ftime=.out | 2 +- t/t1320-earthquakes_-f'([.0-9]+)(?=,m)'.out | 2 +- t/t1402-rounded_-H_-w1.out | 6 +++--- t/t1603-added_statistics_-sL2-.out | 2 +- ...ed_options_-C_1_-l_2_hi_3_--st_4_--_5_-1_--version.out | 4 ++-- "t/t1801-progress_-t-1_-ftime=\\K_?.out" | 2 +- t/t1901-technicolor_-cs_--header.out | 4 ++-- 12 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 t/t1006-unvalued.in create mode 100644 t/t1006-unvalued.out diff --git a/barcat b/barcat index fedb6c9..54761d9 100755 --- a/barcat +++ b/barcat @@ -291,6 +291,10 @@ while ($nr <= $limit) { color($color) for $val; } my $line = $lines[$nr] =~ s/\n/$val/r; + if (not length $val) { + say $line; + next; + } printf '%-*s', $len + length($val), $line; print $barmark[$_] // $opt{'graph-format'} for 1 .. $size && (($values[$nr] || 0) - $minval) * $size + .5; diff --git a/t/t1005-float.out b/t/t1005-float.out index db8ce4f..ad784ea 100644 --- a/t/t1005-float.out +++ b/t/t1005-float.out @@ -12,7 +12,7 @@ -0 -------<--=-| 1.0.0 -------<--=-|----- 2. -------<--=-|--------- -+1 -------<--=-| ++1 1-2 -------<--=-|----- -2.0 ---- ---1 -------<--=-| +--1 diff --git a/t/t1006-unvalued.in b/t/t1006-unvalued.in new file mode 100644 index 0000000..6ef4d1c --- /dev/null +++ b/t/t1006-unvalued.in @@ -0,0 +1,8 @@ +nan +-1 negative +-2 negativer +0 zero +.0 zeroer +-00 zeroest + +1.5 positive diff --git a/t/t1006-unvalued.out b/t/t1006-unvalued.out new file mode 100644 index 0000000..940dfe4 --- /dev/null +++ b/t/t1006-unvalued.out @@ -0,0 +1,8 @@ +nan + -1 negative ------- + -2 negativer + 0 zero ------------=|- + .0 zeroer ------------=|- +-00 zeroest ------------=|- + +1.5 positive ------------=|------------ diff --git a/t/t1008-unicode.out b/t/t1008-unicode.out index cb72b7a..00afe4e 100644 --- a/t/t1008-unicode.out +++ b/t/t1008-unicode.out @@ -28,4 +28,4 @@ 383 Z - # 23731 whitespace 4217 … -<----+-=--->-- - 0 + 0 diff --git a/t/t1301-field_grep_-ftime=.out b/t/t1301-field_grep_-ftime=.out index 436163b..1dad1ed 100644 --- a/t/t1301-field_grep_-ftime=.out +++ b/t/t1301-field_grep_-ftime=.out @@ -10,7 +10,7 @@ PING google.com(ams15s40-in-x0e.1e100.net (2a00:1450:400e:80d::200e)) 56 data by ... icmp_seq=9 9.56 ms -----------+ ... icmp_seq=10 10.0 ms -----------+- ... icmp_seq=11 9.48 ms -----------+ - + --- google.com ping statistics --- 11 packets transmitted, 11 received, 0% packet loss, time 10016ms rtt min/avg/max/mdev = 9.383/9.968/11.810/0.674 ms diff --git a/t/t1320-earthquakes_-f'([.0-9]+)(?=,m)'.out b/t/t1320-earthquakes_-f'([.0-9]+)(?=,m)'.out index 6b62564..7893e18 100644 --- a/t/t1320-earthquakes_-f'([.0-9]+)(?=,m)'.out +++ b/t/t1320-earthquakes_-f'([.0-9]+)(?=,m)'.out @@ -1,4 +1,4 @@ -time,latitude,longitude,depth,mag,magType,nst,gap,dmin,rms,net,id,updated,place,type,horizontalError,depthError,magError,magNst,status,locationSource,magSource +time,latitude,longitude,depth,mag,magType,nst,gap,dmin,rms,net,id,updated,place,type,horizontalError,depthError,magError,magNst,status,locationSource,magSource 2019-09-23T13:32:01.060Z,36.0413322,-120.2453308,13.57,2.48,md,26,131,0.1773,0.12,nc,nc73278290,2019-09-23T14:03:45.416Z,"11km WNW of Avenal, CA",earthquake,0.53,1.66,0.23,16,automatic,nc,nc 2019-09-23T13:16:57.170Z,36.0901667,-117.8598333,5.57,1.33,ml,18,89,0.02765,0.13,ci,ci38853575,2019-09-23T13:20:31.134Z,"9km ENE of Coso Junction, CA",earthquake,0.3,0.49,0.274,14,automatic,ci,ci 2019-09-23T13:13:25.900Z,36.0896683,-117.8626633,4.75,1.16,ml,12,93,0.02856,0.16,ci,ci38853559,2019-09-23T13:16:54.114Z,"9km ENE of Coso Junction, CA",earthquake,0.45,0.9,0.269,8,automatic,ci,ci diff --git a/t/t1402-rounded_-H_-w1.out b/t/t1402-rounded_-H_-w1.out index 34d6eef..cd9ae5e 100644 --- a/t/t1402-rounded_-H_-w1.out +++ b/t/t1402-rounded_-H_-w1.out @@ -4,18 +4,18 @@ 1.0M 1.0M - 1.1M + - + 999μ - 1.0m + 1.0m - + 999 - 1.0k + 1.0k 1.0k - 1.1k + 10k - + 999m - 999m - 1.0 + diff --git a/t/t1603-added_statistics_-sL2-.out b/t/t1603-added_statistics_-sL2-.out index b0c7b03..5d913fb 100644 --- a/t/t1603-added_statistics_-sL2-.out +++ b/t/t1603-added_statistics_-sL2-.out @@ -27,5 +27,5 @@ 383 Z - # 23731 whitespace 4217 … -<----+-=--->-- - 0 + 0 68658 of 77982 total in 29 values over 31 lines (7 min, 2689.03 avg, 9324 max) diff --git a/t/t1722-mixed_options_-C_1_-l_2_hi_3_--st_4_--_5_-1_--version.out b/t/t1722-mixed_options_-C_1_-l_2_hi_3_--st_4_--_5_-1_--version.out index 6722bef..f691205 100644 --- a/t/t1722-mixed_options_-C_1_-l_2_hi_3_--st_4_--_5_-1_--version.out +++ b/t/t1722-mixed_options_-C_1_-l_2_hi_3_--st_4_--_5_-1_--version.out @@ -1,8 +1,8 @@ 1 -----|------ -…-----| +… 3 -----|-----------<-=---+- 4 -----|-----------<-=---+----->- 5 -----|-----------<-=---+----->------- -1 -…-----| +… 12 total in 5 values over 7 lines (-1 min, 2.40 avg, 5 max) diff --git "a/t/t1801-progress_-t-1_-ftime=\\K_?.out" "b/t/t1801-progress_-t-1_-ftime=\\K_?.out" index a04e460..e0c177d 100644 --- "a/t/t1801-progress_-t-1_-ftime=\\K_?.out" +++ "b/t/t1801-progress_-t-1_-ftime=\\K_?.out" @@ -12,7 +12,7 @@ PING google.com(ams15s40-in-x0e.1e100.net (2a00:1450:400e:80d::200e)) 56 data by ... icmp_seq=9 time=9.56 ms -------+ ... icmp_seq=10 time=10.0 ms -------+ ... icmp_seq=11 time=9.48 ms -------+ - + --- google.com ping statistics --- 11 packets transmitted, 11 received, 0% packet loss, time 10016ms rtt min/avg/max/mdev = 9.383/9.968/11.810/0.674 ms diff --git a/t/t1901-technicolor_-cs_--header.out b/t/t1901-technicolor_-cs_--header.out index 8c68b2d..9fe32ca 100644 --- a/t/t1901-technicolor_-cs_--header.out +++ b/t/t1901-technicolor_-cs_--header.out @@ -13,8 +13,8 @@  -0 -------<--=-|  1.0.0 -------<--=-|-----  2. -------<--=-|--------- -+1 -------<--=-| ++1  1-2 -------<--=-|-----  -2.0 ---- ---1 -------<--=-| +--1 -7.459 total in 16 values over 18 lines (-3 min, -0.47 avg, 2 max) -- 2.30.0