mirror of
https://github.com/jqlang/jq.git
synced 2025-04-20 04:47:43 +03:00
Add -b / --binary option for Windows
This commit is contained in:
parent
3e0a118886
commit
0dab2b18d7
@ -164,6 +164,12 @@ sections:
|
|||||||
Colors can be configured with the `JQ_COLORS` environment
|
Colors can be configured with the `JQ_COLORS` environment
|
||||||
variable (see below).
|
variable (see below).
|
||||||
|
|
||||||
|
* `--binary` / `-b`:
|
||||||
|
|
||||||
|
Windows users using WSL, MSYS2, or Cygwin, should use this option
|
||||||
|
when using a native jq.exe, otherwise jq will turn newlines (LFs)
|
||||||
|
into carriage-return-then-newline (CRLF).
|
||||||
|
|
||||||
* `--ascii-output` / `-a`:
|
* `--ascii-output` / `-a`:
|
||||||
|
|
||||||
jq usually outputs non-ASCII Unicode codepoints as UTF-8, even
|
jq usually outputs non-ASCII Unicode codepoints as UTF-8, even
|
||||||
|
10
src/main.c
10
src/main.c
@ -394,6 +394,16 @@ int main(int argc, char* argv[]) {
|
|||||||
options |= RAW_OUTPUT | RAW_NO_LF;
|
options |= RAW_OUTPUT | RAW_NO_LF;
|
||||||
if (!short_opts) continue;
|
if (!short_opts) continue;
|
||||||
}
|
}
|
||||||
|
if (isoption(argv[i], 'b', "binary", &short_opts)) {
|
||||||
|
#ifdef WIN32
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
|
_setmode(fileno(stdin), _O_BINARY);
|
||||||
|
_setmode(fileno(stdout), _O_BINARY);
|
||||||
|
_setmode(fileno(stderr), _O_BINARY);
|
||||||
|
if (!short_opts) continue;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
if (isoption(argv[i], 0, "tab", &short_opts)) {
|
if (isoption(argv[i], 0, "tab", &short_opts)) {
|
||||||
dumpopts &= ~JV_PRINT_INDENT_FLAGS(7);
|
dumpopts &= ~JV_PRINT_INDENT_FLAGS(7);
|
||||||
dumpopts |= JV_PRINT_TAB | JV_PRINT_PRETTY;
|
dumpopts |= JV_PRINT_TAB | JV_PRINT_PRETTY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user