コード例 #1
0
ファイル: CmdLineOutput.hpp プロジェクト: shuoshuorili/OpenCC
    virtual void usage(TCLAP::CmdLineInterface& cmd) {
        std::cout << std::endl << cmd.getMessage() << std::endl
                  << "Author: Carbo Kuo <*****@*****.**>" << std::endl
                  << "Bug Report: http://github.com/BYVoid/OpenCC/issues"
                  << std::endl << std::endl << "Usage: " << std::endl << std::endl;

        _shortUsage(cmd, std::cout);
        std::cout << std::endl;
        std::cout << "Options: " << std::endl << std::endl;
        _longUsage(cmd, std::cout);
        std::cout << std::endl;
    }
コード例 #2
0
//----------------------------------------------------------------------------------------
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();
}
コード例 #3
0
ファイル: CmdLineOutput.hpp プロジェクト: BloodySinner/OpenCC
 virtual void version(TCLAP::CmdLineInterface& cmd) {
   std::cout << std::endl
   << cmd.getMessage() << std::endl
   << "Version: " << cmd.getVersion() << std::endl
   << std::endl;
 }
コード例 #4
0
ファイル: program.cpp プロジェクト: amarawi/gotcloud
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";
}