MCPcopy Create free account
hub / github.com/MonaSolutions/MonaServer / formatOption

Method formatOption

MonaBase/sources/HelpFormatter.cpp:90–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89
90void HelpFormatter::formatOption(ostream& ostr, const Option& option) const
91{
92 int shortLen = option.shortName().length();
93 int fullLen = option.fullName().length();
94
95 int n = 0;
96
97#ifdef _OS_UNIX
98 ostr << SHORT_PREFIX << option.shortName();
99 n += sizeof(SHORT_PREFIX) + option.shortName().length()+2;
100 if (option.takesArgument()) {
101 if (!option.argumentRequired()) {
102 ostr << '[';
103 ++n;
104 }
105 ostr << option.argumentName();
106 n += option.argumentName().length();
107 if (!option.argumentRequired()) {
108 ostr << ']';
109 ++n;
110 }
111 }
112
113 ostr << ", ";
114 n += 2;
115#endif
116
117 ostr << LONG_PREFIX << option.fullName();
118 n += sizeof(LONG_PREFIX)-1+option.fullName().length();
119 if (option.takesArgument()) {
120 if (!option.argumentRequired()) {
121 ostr << '[';
122 ++n;
123 }
124 ostr << '=';
125 ++n;
126 ostr << option.argumentName();
127 n += option.argumentName().length();
128 if (!option.argumentRequired()) {
129 ostr << ']';
130 ++n;
131 }
132 }
133
134 while (n < _indent) {
135 ostr << ' ';
136 ++n;
137 }
138}
139
140
141void HelpFormatter::formatText(ostream& ostr, const string& text, int indent) const {

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.80
takesArgumentMethod · 0.80
argumentRequiredMethod · 0.80

Tested by

no test coverage detected