mirror of
https://github.com/wader/fq.git
synced 2024-12-27 15:42:07 +03:00
parent
a9051e8c5a
commit
c28163f8f4
22
format/json/testdata/json_color.fqtest
vendored
22
format/json/testdata/json_color.fqtest
vendored
@ -1,21 +1,21 @@
|
||||
# TODO: tests descorator with different types, move this test
|
||||
$ fq -C d json.gz
|
||||
|[33;4m00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f[39;24m|[33;4m0123456789abcdef[39;24m|.[37m{}[39m: [37mjson.gz[39m ([37mgzip[39m)
|
||||
[33m0x000[39m|[97m1f[39m [97m8b[39m |[97m.[39m[97m.[39m | [94midentification[39m: [32mraw bits[39m ([37mvalid[39m)
|
||||
[33m0x000[39m| [97m08[39m | [97m.[39m | [94mcompression_method[39m: [32m"deflate"[39m ([36m8[39m)
|
||||
| | | [94mflags[39m[37m{}[39m:
|
||||
|[33;4m00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f[39;24m|[33;4m0123456789abcdef[39;24m|.{}: json.gz (gzip)
|
||||
[33m0x000[39m|[1m1f[22m [1m8b[22m |[1m.[22m[1m.[22m | [94midentification[39m: [32mraw bits[39m (valid)
|
||||
[33m0x000[39m| [1m08[22m | [1m.[22m | [94mcompression_method[39m: [32m"deflate"[39m ([36m8[39m)
|
||||
| | | [94mflags[39m{}:
|
||||
[33m0x000[39m| [90m00[39m | [90m.[39m | [94mtext[39m: [33mfalse[39m
|
||||
[33m0x000[39m| [90m00[39m | [90m.[39m | [94mheader_crc[39m: [33mfalse[39m
|
||||
[33m0x000[39m| [90m00[39m | [90m.[39m | [94mextra[39m: [33mfalse[39m
|
||||
[33m0x000[39m| [90m00[39m | [90m.[39m | [94mname[39m: [33mfalse[39m
|
||||
[33m0x000[39m| [90m00[39m | [90m.[39m | [94mcomment[39m: [33mfalse[39m
|
||||
[33m0x000[39m| [90m00[39m | [90m.[39m | [94mreserved[39m: [36m0[39m
|
||||
[33m0x000[39m| [37m65[39m [37m0a[39m [97m08[39m [37m61[39m | [37me[39m[37m.[39m[97m.[39m[37ma[39m | [94mmtime[39m: [36m1627916901[39m ([37m2021-08-02T15:08:21Z[39m)
|
||||
[33m0x000[39m| 65 0a [1m08[22m 61 | e.[1m.[22ma | [94mmtime[39m: [36m1627916901[39m (2021-08-02T15:08:21Z)
|
||||
[33m0x000[39m| [90m00[39m | [90m.[39m | [94mextra_flags[39m: [36m0[39m
|
||||
[33m0x000[39m| [97m03[39m | [97m.[39m | [94mos[39m: [32m"unix"[39m ([36m3[39m)
|
||||
[33m0x000[39m| [1m03[22m | [1m.[22m | [94mos[39m: [32m"unix"[39m ([36m3[39m)
|
||||
|[33;4m00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f[39;24m|[33;4m0123456789abcdef[39;24m|
|
||||
[33m0x0[0m|[37m7b[39m [37m22[39m [37m61[39m [37m22[39m [37m3a[39m [37m20[39m [37m31[39m [37m32[39m [37m33[39m [37m7d[39m [37m0a[39m| |[37m{[39m[37m"[39m[37ma[39m[37m"[39m[37m:[39m[37m [39m[37m1[39m[37m2[39m[37m3[39m[37m}[39m[37m.[39m| | [94muncompressed[39m: [37m{}[39m ([37mjson[39m)
|
||||
[33m0x000[39m| [97mab[39m [37m56[39m [37m4a[39m [37m54[39m [97mb2[39m [37m52[39m| [97m.[39m[37mV[39m[37mJ[39m[37mT[39m[97m.[39m[37mR[39m| [94mcompressed[39m: [32mraw bits[39m
|
||||
[33m0x010[39m|[37m30[39m [37m34[39m [37m32[39m [97mae[39m [97me5[39m [97m02[39m [90m00[39m |[37m0[39m[37m4[39m[37m2[39m[97m.[39m[97m.[39m[97m.[39m[90m.[39m |
|
||||
[33m0x010[39m| [37m20[39m [97mac[39m [97md2[39m [97m9c[39m | [37m [39m[97m.[39m[97m.[39m[97m.[39m | [94mcrc32[39m: [36m0x9cd2ac20[39m ([37mvalid[39m)
|
||||
[33m0x010[39m| [37m0b[39m [90m00[39m [90m00[39m [90m00[39m| | [37m.[39m[90m.[39m[90m.[39m[90m.[39m|| [94misize[39m: [36m11[39m
|
||||
[33m0x0[0m|7b 22 61 22 3a 20 31 32 33 7d 0a| |{"a": 123}.| | [94muncompressed[39m: {} (json)
|
||||
[33m0x000[39m| [1mab[22m 56 4a 54 [1mb2[22m 52| [1m.[22mVJT[1m.[22mR| [94mcompressed[39m: [32mraw bits[39m
|
||||
[33m0x010[39m|30 34 32 [1mae[22m [1me5[22m [1m02[22m [90m00[39m |042[1m.[22m[1m.[22m[1m.[22m[90m.[39m |
|
||||
[33m0x010[39m| 20 [1mac[22m [1md2[22m [1m9c[22m | [1m.[22m[1m.[22m[1m.[22m | [94mcrc32[39m: [36m0x9cd2ac20[39m (valid)
|
||||
[33m0x010[39m| 0b [90m00[39m [90m00[39m [90m00[39m| | .[90m.[39m[90m.[39m[90m.[39m|| [94misize[39m: [36m11[39m
|
||||
|
@ -1,6 +1,8 @@
|
||||
def _esc: "\u001b";
|
||||
def _ansi_codes:
|
||||
{ black: {set: "30", reset: "39"}
|
||||
{ bold: {set: "1", reset: "0"}
|
||||
, faint: {set: "2", reset: "0"}
|
||||
, black: {set: "30", reset: "39"}
|
||||
, red: {set: "31", reset: "39"}
|
||||
, green: {set: "32", reset: "39"}
|
||||
, yellow: {set: "33", reset: "39"}
|
||||
@ -16,7 +18,7 @@ def _ansi_codes:
|
||||
, brightmagenta: {set: "95", reset: "39"}
|
||||
, brightcyan: {set: "96", reset: "39"}
|
||||
, brightwhite: {set: "97", reset: "39"}
|
||||
, reset: {set: "39", reset: "39"}
|
||||
, default: {set: "39", reset: "39"}
|
||||
, bgblack: {set: "40", reset: "49"}
|
||||
, bgred: {set: "41", reset: "49"}
|
||||
, bggreen: {set: "42", reset: "49"}
|
||||
|
@ -10,16 +10,16 @@ def _opt_build_default_fixed:
|
||||
, argjson: []
|
||||
, array_truncate: 50
|
||||
, bits_format: "string"
|
||||
# 0-0xff=brightwhite,0=brightblack,32-126:9-13=white
|
||||
# 0-0xff=brightwhite,0=brightblack,32-126:9-13=default
|
||||
, byte_colors:
|
||||
[ { ranges: [[0,255]]
|
||||
, value: "brightwhite"
|
||||
, value: "default+bold"
|
||||
}
|
||||
, { ranges: [[0]]
|
||||
, value: "brightblack"
|
||||
}
|
||||
, { ranges: [[32,126],[9,13]]
|
||||
, value: "white"
|
||||
, value: "default"
|
||||
}
|
||||
]
|
||||
, color: ($stdout.is_terminal and (env.NO_COLOR | . == null or . == ""))
|
||||
@ -30,15 +30,15 @@ def _opt_build_default_fixed:
|
||||
, number: "cyan"
|
||||
, string: "green"
|
||||
, objectkey: "brightblue"
|
||||
, array: "white"
|
||||
, object: "white"
|
||||
, index: "white"
|
||||
, value: "white"
|
||||
, array: "default"
|
||||
, object: "default"
|
||||
, index: "default"
|
||||
, value: "default"
|
||||
, error: "brightred"
|
||||
, dumpheader: "yellow+underline"
|
||||
, dumpaddr: "yellow"
|
||||
, prompt_repl_level: "brightblack"
|
||||
, prompt_value: "white"
|
||||
, prompt_value: "default"
|
||||
}
|
||||
, compact: false
|
||||
, completion_timeout: (env.COMPLETION_TIMEOUT | if . != null then tonumber else 1 end)
|
||||
@ -278,7 +278,7 @@ def _opt_from_array: tojson;
|
||||
# TODO: cleanup
|
||||
def _trim: capture("^\\s*(?<str>.*?)\\s*$"; "").str;
|
||||
|
||||
# "0-255=brightwhite,0=brightblack,32-126:9-13=white" -> [{"ranges": [[0-255]], value: "brightwhite"}, ...]
|
||||
# "0-255=brightwhite,0=brightblack,32-126:9-13=default" -> [{"ranges": [[0-255]], value: "brightwhite"}, ...]
|
||||
def _csv_ranges_to_array:
|
||||
( split(",")
|
||||
| map(
|
||||
|
4
pkg/interp/testdata/args.fqtest
vendored
4
pkg/interp/testdata/args.fqtest
vendored
@ -73,9 +73,9 @@ argdecode []
|
||||
argjson []
|
||||
array_truncate 50
|
||||
bits_format string
|
||||
byte_colors 0-255=brightwhite,0=brightblack,32-126:9-13=white
|
||||
byte_colors 0-255=default+bold,0=brightblack,32-126:9-13=default
|
||||
color false
|
||||
colors array=white,dumpaddr=yellow,dumpheader=yellow+underline,error=brightred,false=yellow,index=white,null=brightblack,number=cyan,object=white,objectkey=brightblue,prompt_repl_level=brightblack,prompt_value=white,string=green,true=yellow,value=white
|
||||
colors array=default,dumpaddr=yellow,dumpheader=yellow+underline,error=brightred,false=yellow,index=default,null=brightblack,number=cyan,object=default,objectkey=brightblue,prompt_repl_level=brightblack,prompt_value=default,string=green,true=yellow,value=default
|
||||
compact false
|
||||
completion_timeout 10
|
||||
decode_group probe
|
||||
|
14
pkg/interp/testdata/options.fqtest
vendored
14
pkg/interp/testdata/options.fqtest
vendored
@ -16,7 +16,7 @@ $ fq -n options
|
||||
255
|
||||
]
|
||||
],
|
||||
"value": "brightwhite"
|
||||
"value": "default+bold"
|
||||
},
|
||||
{
|
||||
"ranges": [
|
||||
@ -37,26 +37,26 @@ $ fq -n options
|
||||
13
|
||||
]
|
||||
],
|
||||
"value": "white"
|
||||
"value": "default"
|
||||
}
|
||||
],
|
||||
"color": false,
|
||||
"colors": {
|
||||
"array": "white",
|
||||
"array": "default",
|
||||
"dumpaddr": "yellow",
|
||||
"dumpheader": "yellow+underline",
|
||||
"error": "brightred",
|
||||
"false": "yellow",
|
||||
"index": "white",
|
||||
"index": "default",
|
||||
"null": "brightblack",
|
||||
"number": "cyan",
|
||||
"object": "white",
|
||||
"object": "default",
|
||||
"objectkey": "brightblue",
|
||||
"prompt_repl_level": "brightblack",
|
||||
"prompt_value": "white",
|
||||
"prompt_value": "default",
|
||||
"string": "green",
|
||||
"true": "yellow",
|
||||
"value": "white"
|
||||
"value": "default"
|
||||
},
|
||||
"compact": false,
|
||||
"completion_timeout": 10,
|
||||
|
4
pkg/interp/testdata/repl.fqtest
vendored
4
pkg/interp/testdata/repl.fqtest
vendored
@ -6,9 +6,9 @@ null
|
||||
null> 1+1
|
||||
2
|
||||
null> repl({color: true})
|
||||
[90m>[39m [37mnull[39m> )
|
||||
[90m>[39m [39mnull[39m> )
|
||||
^ unexpected token ")"
|
||||
[90m>[39m [37mnull[39m> ^D
|
||||
[90m>[39m [39mnull[39m> ^D
|
||||
null> )
|
||||
^ unexpected token ")"
|
||||
null>
|
||||
|
2
pkg/interp/testdata/unicode.fqtest
vendored
2
pkg/interp/testdata/unicode.fqtest
vendored
@ -3,7 +3,7 @@ $ _STDOUT_IS_TERMINAL=0 NO_COLOR= CLIUNICODE=1 fq -n '[123] | hexdump'
|
||||
0x0|7b| |{| |.: raw bits 0x0-0x0.7 (1)
|
||||
$ _STDOUT_IS_TERMINAL=1 NO_COLOR= CLIUNICODE=1 fq -n '[123] | hexdump'
|
||||
│[33;4m00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f[39;24m│[33;4m0123456789abcdef[39;24m│
|
||||
[33m0x0[39m│[37m7b[39m│ │[37m{[39m│ │.: [32mraw bits[39m 0x0-0x0.7 (1)
|
||||
[33m0x0[39m│7b│ │{│ │.: [32mraw bits[39m 0x0-0x0.7 (1)
|
||||
$ NO_COLOR=1 fq -Un '[123] | hexdump'
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│
|
||||
0x0│7b│ │{│ │.: raw bits 0x0-0x0.7 (1)
|
||||
|
Loading…
Reference in New Issue
Block a user