interfaces for help message reporting
| 178 | |
| 179 | /// interfaces for help message reporting |
| 180 | virtual void usage( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) |
| 181 | { |
| 182 | namespace utils = unit_test::utils; |
| 183 | namespace ut_detail = unit_test::ut_detail; |
| 184 | |
| 185 | // |
| 186 | ostr << " "; |
| 187 | { |
| 188 | |
| 189 | BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); |
| 190 | ostr << p_name; |
| 191 | } |
| 192 | |
| 193 | ostr << '\n'; |
| 194 | |
| 195 | if( !p_description.empty() ) { |
| 196 | commandline_pretty_print(ostr, " ", p_description) << '\n'; |
| 197 | } |
| 198 | |
| 199 | BOOST_TEST_FOREACH( parameter_cla_id const&, id, cla_ids() ) { |
| 200 | if( id.m_prefix == help_prefix ) |
| 201 | continue; |
| 202 | |
| 203 | ostr << " " << id.m_prefix; |
| 204 | |
| 205 | if( id.m_negatable ) |
| 206 | cla_name_help( ostr, id.m_tag, negation_prefix_, use_color ); |
| 207 | else |
| 208 | cla_name_help( ostr, id.m_tag, "", use_color ); |
| 209 | |
| 210 | BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); |
| 211 | bool optional_value_ = false; |
| 212 | |
| 213 | if( p_has_optional_value ) { |
| 214 | optional_value_ = true; |
| 215 | ostr << '['; |
| 216 | } |
| 217 | |
| 218 | |
| 219 | if( id.m_value_separator.empty() ) |
| 220 | ostr << ' '; |
| 221 | else { |
| 222 | ostr << id.m_value_separator; |
| 223 | } |
| 224 | |
| 225 | value_help( ostr ); |
| 226 | |
| 227 | if( optional_value_ ) |
| 228 | ostr << ']'; |
| 229 | |
| 230 | ostr << '\n'; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | virtual void help( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) |
| 235 | { |