From 3690e83d86314a6c9b1c914560942ee4ff467fea Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 12 Mar 2020 16:52:26 +1100 Subject: [PATCH] Rename example/jsonptr's -compact flag --- example/jsonptr/jsonptr.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/example/jsonptr/jsonptr.cc b/example/jsonptr/jsonptr.cc index 1486c705..a4148a3b 100644 --- a/example/jsonptr/jsonptr.cc +++ b/example/jsonptr/jsonptr.cc @@ -117,7 +117,7 @@ static const char* usage = "Usage: jsonptr -flags input.json\n" "\n" "Flags:\n" - " -c -compact\n" + " -c -compact-output\n" " -i=NUM -indent=NUM\n" " -o=NUM -max-output-depth=NUM\n" " -q=STR -query=STR\n" @@ -138,7 +138,7 @@ static const char* usage = "duplicate keys. Canonicalization does not imply Unicode normalization.\n" "\n" "Formatted means that arrays' and objects' elements are indented, each\n" - "on its own line. Configure this with the -c / -compact, -i=NUM /\n" + "on its own line. Configure this with the -c / -compact-output, -i=NUM /\n" "-indent=NUM (for NUM ranging from 0 to 8) and -t / -tabs flags.\n" "\n" "----\n" @@ -511,7 +511,7 @@ struct { int remaining_argc; char** remaining_argv; - bool compact; + bool compact_output; bool fail_if_unsandboxed; size_t indent; uint32_t max_output_depth; @@ -545,8 +545,8 @@ parse_flags(int argc, char** argv) { } } - if (!strcmp(arg, "c") || !strcmp(arg, "compact")) { - flags.compact = true; + if (!strcmp(arg, "c") || !strcmp(arg, "compact-output")) { + flags.compact_output = true; continue; } if (!strcmp(arg, "fail-if-unsandboxed")) { @@ -812,7 +812,7 @@ handle_token(wuffs_base__token t) { } else { // Write preceding whitespace. if ((ctx != context::in_list_after_bracket) && - (ctx != context::in_dict_after_brace) && !flags.compact) { + (ctx != context::in_dict_after_brace) && !flags.compact_output) { TRY(write_dst("\n", 1)); for (uint32_t i = 0; i < depth; i++) { TRY(write_dst(flags.tabs ? INDENT_TAB_STRING : INDENT_SPACES_STRING, @@ -835,13 +835,13 @@ handle_token(wuffs_base__token t) { // continuation of a multi-token chain. if (!t.link_prev()) { if (ctx == context::in_dict_after_key) { - TRY(write_dst(": ", flags.compact ? 1 : 2)); + TRY(write_dst(": ", flags.compact_output ? 1 : 2)); } else if (ctx != context::none) { if ((ctx != context::in_list_after_bracket) && (ctx != context::in_dict_after_brace)) { TRY(write_dst(",", 1)); } - if (!flags.compact) { + if (!flags.compact_output) { TRY(write_dst("\n", 1)); for (size_t i = 0; i < depth; i++) { TRY(write_dst(flags.tabs ? INDENT_TAB_STRING : INDENT_SPACES_STRING,