MCPcopy Create free account
hub / github.com/apache/trafficserver / writeToStream

Method writeToStream

lib/catch2/catch.hpp:9538–9577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9536 }
9537
9538 void writeToStream( std::ostream &os ) const {
9539 if (!m_exeName.name().empty()) {
9540 os << "usage:\n" << " " << m_exeName.name() << " ";
9541 bool required = true, first = true;
9542 for( auto const &arg : m_args ) {
9543 if (first)
9544 first = false;
9545 else
9546 os << " ";
9547 if( arg.isOptional() && required ) {
9548 os << "[";
9549 required = false;
9550 }
9551 os << "<" << arg.hint() << ">";
9552 if( arg.cardinality() == 0 )
9553 os << " ... ";
9554 }
9555 if( !required )
9556 os << "]";
9557 if( !m_options.empty() )
9558 os << " options";
9559 os << "\n\nwhere options are:" << std::endl;
9560 }
9561
9562 auto rows = getHelpColumns();
9563 size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;
9564 size_t optWidth = 0;
9565 for( auto const &cols : rows )
9566 optWidth = (std::max)(optWidth, cols.left.size() + 2);
9567
9568 optWidth = (std::min)(optWidth, consoleWidth/2);
9569
9570 for( auto const &cols : rows ) {
9571 auto row =
9572 TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +
9573 TextFlow::Spacer(4) +
9574 TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );
9575 os << row << std::endl;
9576 }
9577 }
9578
9579 friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {
9580 parser.writeToStream( os );

Callers 1

operator<<Method · 0.80

Calls 10

SpacerClass · 0.85
isOptionalMethod · 0.80
hintMethod · 0.80
ColumnClass · 0.70
emptyMethod · 0.45
nameMethod · 0.45
cardinalityMethod · 0.45
sizeMethod · 0.45
indentMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected