//----------------------------------------------------------------------------------------
void cci_cli_output::usage( tclap::CmdLineInterface& c )
{
        std::cerr << colors[stamp_color::none]
                  << "\nusage for cci-trinity-tunnel:\n"
                  << m_ptr_ostr->str()
                  << "\n\n";
        std::list<tclap::Arg*> args = c.getArgList();
		for( auto elem : args )
        {
              std::cerr  << "\t"
                         << elem->longID()
                         << "\n\t\t"
                         << "(";
             if( elem->isRequired() ) { std::cerr << colors[stamp_color::red];  }
             std::cerr << elem->getDescription()
                       << colors[stamp_color::none]
                       << ")"
                       << "\n";
        }
       m_tmu->clear_color();
}
Beispiel #2
0
void VTOutput::usage(TCLAP::CmdLineInterface& c)
{
    std::string s = "";
    std::list<TCLAP::Arg*> args = c.getArgList();
    //prints unlabeled arument list first
    for (TCLAP::ArgListIterator it = args.begin(); it != args.end(); it++)
    {
        if (typeid(**it)==typeid(TCLAP::UnlabeledValueArg<std::string>))
        {
            TCLAP::UnlabeledValueArg<std::string> *i = (TCLAP::UnlabeledValueArg<std::string> *) (*it);
            s = i->getName();
        }
        else if (typeid(**it)==typeid(TCLAP::UnlabeledMultiArg<std::string>))
        {
            TCLAP::UnlabeledMultiArg<std::string> *i = (TCLAP::UnlabeledMultiArg<std::string> *) (*it);
            s = i->getName();
        }
    }

    std::clog << c.getProgramName() << " v" << c.getVersion() << "\n\n";
    std::clog << "description : " << c.getMessage() << "\n\n";
    std::clog << "usage : vt "  << c.getProgramName() << " [options] " << s << "\n\n";

    //prints rest of arguments
    for (TCLAP::ArgListIterator it = args.begin(); it != args.end(); it++)
    {
        if (it==args.begin())
        {
            std::clog << "options : ";
        }
        else
        {
            std::clog << "          ";
        }

        if (typeid(**it)==typeid(TCLAP::ValueArg<std::string>) ||
            typeid(**it)==typeid(TCLAP::ValueArg<uint32_t>) ||
            typeid(**it)==typeid(TCLAP::ValueArg<int32_t>) ||
            typeid(**it)==typeid(TCLAP::ValueArg<double>) ||
            typeid(**it)==typeid(TCLAP::ValueArg<float>))
        {
            TCLAP::ValueArg<std::string> *i = (TCLAP::ValueArg<std::string> *) (*it);

            std::clog  << "-" << i->getFlag()
                       << "  " << i->getDescription() << "\n";
        }
        else if (typeid(**it)==typeid(TCLAP::SwitchArg))
        {
            TCLAP::SwitchArg *i = (TCLAP::SwitchArg *) (*it);

            std::clog  << "-" << i->getFlag()
                       << "  " << i->getDescription() << "\n";
        }
        else if (typeid(**it)==typeid(TCLAP::UnlabeledValueArg<std::string>))
        {
            //ignored
        }
        else if (typeid(**it)==typeid(TCLAP::UnlabeledMultiArg<std::string>))
        {
            //ignored
        }
        else
        {
            std::clog << "oops, argument type not handled\n";
        }
    }

    std::clog  <<  "\n";
}