Exemplo n.º 1
0
void
Builder::displayUsage( const std::string & progname )
{
    std::cout << "\nUsage: " << progname << " [[-[-]]namespace::option=value]\n"
              <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' '
              << " [[-[-]][namespace::]help]\n"
              <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' '
              << " [[-[-]]include=file]\n"
//               <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' '
//               << " [[-[-]]load=library]\n"
//               <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' '
//               << " [[-[-]]setpath=path]\n"
//               <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' '
//               << " [[-[-]]addpath=path] ...\n";
        ;
    std::cout << "Options:\n";
    displayHelpEntry( std::cout,
                      "help",
                      "display generic help" );
    displayHelpEntry( std::cout,
                      "include=file",
                      "parse the specified configuration file."
                      "  Configuration files have the same format as the command line options."
                      " The configuration file specified will be parsed before all subsequent options.");
}
Exemplo n.º 2
0
void
Builder::displayDetailedHelp()
{
    std::cout << m_module_name << " Options:\n";

    std::ostream & conf = std::cout;
    for ( IntMap::iterator iter = m_ints.begin();
          iter != m_ints.end();
          ++iter )
    {
        displayHelpEntry( conf,
                          m_module_name,
                          iter->first,
                          iter->second.get(),
                          iter->second.desc() );
    }

    for ( BoolMap::iterator iter = m_bools.begin();
          iter != m_bools.end();
          ++iter )
    {
        displayHelpEntry( conf,
                          m_module_name,
                          iter->first,
                          iter->second.get(),
                          iter->second.desc() );
    }

    for ( DoubMap::iterator iter = m_doubs.begin();
          iter != m_doubs.end();
          ++iter )
    {
        displayHelpEntry( conf,
                          m_module_name,
                          iter->first,
                          iter->second.get(),
                          iter->second.desc() );
    }

    for ( StrMap::iterator iter = m_strs.begin();
          iter != m_strs.end();
          ++iter )
    {
        displayHelpEntry( conf,
                          m_module_name,
                          iter->first,
                          iter->second.get(),
                          iter->second.desc() );
    }
}
Exemplo n.º 3
0
void
Builder::displayGenericHelp()
{
    displayHelpEntry( std::cout,
                      m_module_name,
                      "help",
                      "display detailed help for the \"" + m_module_name + "\" module" );
}
Exemplo n.º 4
0
		void
		Builder::displayUsage( const std::string& progname ) 
		{
			std::cout << "\nUsage: " << progname << " [[-[-]]namespace::option=value]\n" 
					  <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' ' 
					  << " [[-[-]][namespace::]help]\n"
					  <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' ' 
					  << " [[-[-]]include=file]\n"
					  <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' ' 
					  << " [[-[-]]load=library]\n"
					  <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' ' 
					  << " [[-[-]]setpath=path]\n"
					  <<   "       " << std::setfill(' ')  << std::setw( progname.length() ) <<  ' ' 
					  << " [[-[-]]addpath=path] ...\n";
			std::cout << "Options:\n";
			displayHelpEntry( std::cout,
							  "help",
							  "display generic help" );
			displayHelpEntry( std::cout,
							  "include=file",
							  "parse the specified configuration file.  Configuration files have the same format as the command line options. The configuration file specified will be parsed before all subsequent options.");
			const std::vector< boost::filesystem::path >& modules = lib::Loader::listAvailableModules();
			std::string load_entry = "load a dynamic library.  If the library registers a configuration builder, then it will handle all configuration options within it's namespace that are parsed after the point that it is loaded.  If you set a configuration option that is supposed to be handled by the library before the library is loaded, it will be ignored.";
			if( modules.empty() )
			{
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
				if( system( "rcssmodtest.exe -q" ) )
				{
					load_entry += "\n\nA list of the avaiable modules cannot be produced because rcssmodtest in not in your PATH";
				}
				else
				{
					load_entry += "\n\nNo modules are currently available";
				}
				
#else

				if( system( "which rcssmodtest > /dev/null 2>&1" ) )
				{
					load_entry += "\n\nA list of the avaiable modules cannot be produced because rcssmodtest in not in your PATH";
				}
				else
				{
					load_entry += "\n\nNo modules are currently available";
				}
#endif
			}
			else
			{
				load_entry += "\n\nAvailable modules:";
				for( std::vector< boost::filesystem::path >::const_iterator i = modules.begin();
					 i != modules.end(); ++i )
				{
					load_entry += "\n\t- ";
					load_entry += i->native_file_string();
				}
			}
			displayHelpEntry( std::cout,
							  "load=library",
							  load_entry );
			std::string setpath_entry = "Set the directory(s) to look in for dynamic modules when the load option is specified.\n*Note*:  This option only affects subsequent occurances of the load directive. i.e specifying setpath after specifying load, has no affect on that load.";
			std::vector< boost::filesystem::path > curr_path = lib::Loader::getPath();
			setpath_entry += "\n\nCurrent search path:";
			if( curr_path.empty() )
				setpath_entry += "\n\tdefault";
			else
			{
				for( std::vector< boost::filesystem::path >::const_iterator i = curr_path.begin();
					 i != curr_path.end(); ++i )
				{
					setpath_entry += "\n\t" + i->native_directory_string();
				}
			}
			displayHelpEntry( std::cout,
							  "setpath=path",
							  setpath_entry );
			displayHelpEntry( std::cout,
							  "addpath=path",
							  "Add the directory(s) to the path to look though for dynamic modules when the load option is specified.\n*Note*:  This option only affects subsequent occurances of the load directive. i.e specifying addpath after specifying load, has no affect on that load.");
		}