diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-06 19:00:34 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-06 19:00:34 -0500 |
commit | fb60761c469f3b144e741cef14762a5b6a037112 (patch) | |
tree | 6f40a8683d2d3a89ec0c77e3cef65f86af379d78 /tools | |
parent | c05569d223d5bda4390f1c501dc5915149617c93 (diff) | |
download | horizon-fb60761c469f3b144e741cef14762a5b6a037112.tar.gz horizon-fb60761c469f3b144e741cef14762a5b6a037112.tar.bz2 horizon-fb60761c469f3b144e741cef14762a5b6a037112.tar.xz horizon-fb60761c469f3b144e741cef14762a5b6a037112.zip |
Add some pretty handlers and use them
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hscript-validate/validator.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/hscript-validate/validator.cc b/tools/hscript-validate/validator.cc index addc968..3683b5d 100644 --- a/tools/hscript-validate/validator.cc +++ b/tools/hscript-validate/validator.cc @@ -19,6 +19,7 @@ int main(int argc, char *argv[]) { Horizon::ScriptOptions opts; int result_code = EXIT_SUCCESS; std::string installfile; + using Horizon::ScriptOptionFlags; /* Default to pretty if we are using a TTY, unless -n specified. */ if(isatty(1) && isatty(2)) { @@ -28,10 +29,10 @@ int main(int argc, char *argv[]) { auto cli = ( clipp::value("installfile", installfile), clipp::option("-k", "--keep-going").doc("Continue parsing after errors")( - [&opts] { opts.set(Horizon::ScriptOptionFlags::KeepGoing); } + [&opts] { opts.set(ScriptOptionFlags::KeepGoing); } ), clipp::option("-n", "--no-colour").doc("Do not 'prettify' output")( - [&opts] { opts.reset(Horizon::ScriptOptionFlags::Pretty); } + [&opts] { opts.reset(ScriptOptionFlags::Pretty); } ) ); if(!clipp::parse(argc, argv, cli)) { @@ -40,13 +41,9 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - if(opts.test(Horizon::ScriptOptionFlags::Pretty)) { - std::cout << "\033[1m"; - } + bold_if_pretty(opts.test(ScriptOptionFlags::Pretty), std::cout); std::cout << "HorizonScript Validation Utility version 0.1.0"; - if(opts.test(Horizon::ScriptOptionFlags::Pretty)) { - std::cout << "\033[0m"; - } + reset_if_pretty(opts.test(ScriptOptionFlags::Pretty), std::cout); std::cout << std::endl; std::cout << "Copyright (c) 2019 Adélie Linux and contributors. AGPL-3.0 license." << std::endl; std::cout << std::endl; |