13 std::stringstream out;
14 if (!opt->get_envname().empty()) {
15 out <<
" [" << opt->get_envname() <<
"]";
22 const size_t wrap_width = 60;
23 std::stringstream out;
25 if (opt->get_required()) {
26 out <<
"\e[3mREQUIRED\e[0m ";
28 std::string desc = opt->get_description();
30 CLI::Validator* is_member_validator =
get_validator(
const_cast<CLI::Option*
>(opt),
"is_member");
31 if (is_member_validator) {
33 std::string options = is_member_validator->get_description();
41 const size_t left_col_width = 25;
42 const size_t wrap_width = 60;
43 std::stringstream out;
44 std::string name = sub->get_display_name(
true) + (sub->get_required() ?
" " + get_label(
"REQUIRED") :
"");
45 out <<
std::setw(left_col_width) << std::left << name;
46 std::string desc = sub->get_description();
47 std::istringstream iss(desc);
49 size_t current_line_length = 0;
50 std::string indent(left_col_width,
' ');
51 bool first_word =
true;
53 if (!first_word && current_line_length + word.size() + 1 > wrap_width) {
54 out <<
"\n" << indent;
55 current_line_length = 0;
56 }
else if (!first_word) {
58 current_line_length++;
61 current_line_length += word.size();
68 std::string
make_help(
const CLI::App* app, std::string name, CLI::AppFormatMode mode)
const override
70 std::stringstream out;
71 if (mode == CLI::AppFormatMode::Normal) {
72 out << CLI::Formatter::make_help(app, name, mode);
78 static void wrap_text(std::ostream& out,
const std::string& text,
size_t width)
80 std::istringstream words(text);
82 size_t line_length = 0;
83 while (words >> word) {
84 if (line_length + word.length() + 1 > width) {
88 if (line_length > 0) {
93 line_length += word.length();
97 CLI::Validator*
get_validator(CLI::Option* opt,
const std::string& name)
const
99 CLI::Validator* result;
101 result = opt->get_validator(name);
102 }
catch (
const CLI::OptionNotFound& err) {
108 std::string
replace(std::string& in,
const std::string& pat,
const std::string& rep)
const
111 while ((pos = in.find(pat, pos)) != std::string::npos) {
112 in.replace(pos, pat.size(), rep);
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept