MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / usage

Method usage

lib/po/argument_parser.cpp:116–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void ArgumentParser::SubCommandDescriptor::usage(
117 std::FILE *Out) const noexcept {
118 fmt::print(Out, "{}USAGE{}\n"sv, YELLOW_COLOR, RESET_COLOR);
119 for (const char *Part : ProgramNames) {
120 fmt::print(Out, "\t{}"sv, Part);
121 }
122 if (!SubCommandList.empty()) {
123 fmt::print(Out, " [SUBCOMMANDS]"sv);
124 }
125 if (!NonpositionalList.empty()) {
126 fmt::print(Out, " [OPTIONS]"sv);
127 }
128 bool First = true;
129 for (const auto &Index : PositionalList) {
130 const auto &Desc = ArgumentDescriptors[Index];
131 if (Desc.hidden()) {
132 continue;
133 }
134
135 if (First) {
136 fmt::print(Out, " [--]"sv);
137 First = false;
138 }
139
140 const bool Optional = (Desc.min_nargs() == 0);
141 fmt::print(Out, " "sv);
142 if (Optional) {
143 fmt::print(Out, "["sv);
144 }
145 switch (ArgumentDescriptors[Index].max_nargs()) {
146 case 0:
147 break;
148 case 1:
149 fmt::print(Out, "{}"sv, Desc.meta());
150 break;
151 default:
152 fmt::print(Out, "{} ..."sv, Desc.meta());
153 break;
154 }
155 if (Optional) {
156 fmt::print(Out, "]"sv);
157 }
158 }
159 fmt::print(Out, "\n"sv);
160}
161
162void ArgumentParser::SubCommandDescriptor::help(std::FILE *Out) const noexcept {
163// For enabling Windows PowerShell color support.

Callers

nothing calls this directly

Calls 4

printFunction · 0.85
emptyMethod · 0.45
hiddenMethod · 0.45
metaMethod · 0.45

Tested by

no test coverage detected