summaryrefslogtreecommitdiff
path: root/Userland/Utilities/gron.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-12-14 17:10:34 +0000
committerLinus Groh <mail@linusgroh.de>2022-12-15 12:20:37 +0000
commitd4f74d6c48dd46f8a23401c57b308fae6977c2ea (patch)
treedcb5ea24bfc2d66bd484d926f23338c50e2dfecc /Userland/Utilities/gron.cpp
parenta3423f2af29818683faaade5bd9f28d0a824cb3b (diff)
downloadserenity-d4f74d6c48dd46f8a23401c57b308fae6977c2ea.zip
gron: Add options for enabling/disabling colored output
These match the options in the original gron: https://github.com/tomnomnom/gron
Diffstat (limited to 'Userland/Utilities/gron.cpp')
-rw-r--r--Userland/Utilities/gron.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Utilities/gron.cpp b/Userland/Utilities/gron.cpp
index 6e77a33f03..925cc70fea 100644
--- a/Userland/Utilities/gron.cpp
+++ b/Userland/Utilities/gron.cpp
@@ -38,6 +38,19 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.set_general_help("Print each value in a JSON file with its fully expanded key.");
StringView path;
+ args_parser.add_option(use_color, "Colorize output (default on tty)", "colorize", 'c');
+ args_parser.add_option(Core::ArgsParser::Option {
+ Core::ArgsParser::OptionArgumentMode::None,
+ "Monochrome (don't colorize output)",
+ "monochrome",
+ 'm',
+ nullptr,
+ [](char const* s) {
+ VERIFY(s == nullptr);
+ use_color = false;
+ return true;
+ },
+ });
args_parser.add_positional_argument(path, "Input", "input", Core::ArgsParser::Required::No);
args_parser.parse(arguments);