Argparse: colored help output by default (NO_COLOR aware)

This commit is contained in:
faumaray committed 2026-12-04 08:01:19 +03:00
1 parent b8e6e924a8
commit 5e70ad2bc4
2 files changed
+49 -11

No files matched your search

+5
View File
@@ -140,6 +140,10 @@ namespace Void::Argparse
// Omit an option or flag from the generated help.
Parser& hide(std::string_view long_name);
// Enable or disable ANSI styling in help text (default: enabled,
// unless the NO_COLOR environment variable is set).
Parser& color(bool enabled) noexcept;
// Add a required positional argument.
Parser& positional(std::string_view name,
std::string_view description, std::string& out);
@@ -214,6 +218,7 @@ namespace Void::Argparse
};
std::string program_, description_, version_;
bool m_color{true};
std::vector<std::pair<std::string, std::string>> conflicts_;
std::vector<FlagEntry> flags_;
std::vector<OptionEntry> options_;