示例#1
0
	void SubstrApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"left", "l", "extract substring at left side.").required(
				false).repeatable(false).group("substr").binding(
				"smartcube.str.substr.left"));

		options.addOption(Poco::Util::Option(
				"right", "r", "extract substring at right side.").required(
				false).repeatable(false).group("substr").binding(
				"smartcube.str.substr.right"));

		options.addOption(Poco::Util::Option(
				"mid", "m", "extract substring at middle. [default]").required(
				false).repeatable(false).group("substr").binding(
				"smartcube.str.substr.mid"));

		options.addOption(Poco::Util::Option(
				"start", "s", "specify start position.").required(
				false).repeatable(false).argument("start", true).binding(
				"smartcube.str.substr.start"));

		options.addOption(Poco::Util::Option(
				"size", "n", "specify length of substring.").required(
				false).repeatable(false).argument("size", true).binding(
				"smartcube.str.substr.size"));
	}
示例#2
0
	void HALService::defineOptions(Poco::Util::OptionSet& options) {
		Application::defineOptions(options);

		options.addOption(
				Poco::Util::Option("help", "h", "display help information").required(false).repeatable(false).callback(
						Poco::Util::OptionCallback<HALService>(this, &HALService::handleHelp)));

		//options.addOption(
		//		Poco::Util::Option("mode", "m", "virtual or real mode").required(true).repeatable(false)/*.argument("mode=value")*/.callback(
		//				Poco::Util::OptionCallback<HALService>(this, &HALService::handleMode)));

		options.addOption(
				Poco::Util::Option("bioradar", "b", "use bio radar").required(false).repeatable(false).argument("bioradar=value").callback(
						Poco::Util::OptionCallback<HALService>(this, &HALService::handleBioRadarEnable)));

		options.addOption(
				Poco::Util::Option("manipulator", "m", "use manipulator").required(false).repeatable(false).argument("manipulator=value").callback(
						Poco::Util::OptionCallback<HALService>(this, &HALService::handleManipulatorEnable)));

		options.addOption(
				Poco::Util::Option("port1", "q1", "manipulator serial port 1 number").required(false).repeatable(false).argument("manport1=value").callback(
						Poco::Util::OptionCallback<HALService>(this, &HALService::handleManipulatorPort1)));
		options.addOption(
				Poco::Util::Option("port2", "q2", "manipulator serial port 2 number").required(false).repeatable(false).argument("manport2=value").callback(
						Poco::Util::OptionCallback<HALService>(this, &HALService::handleManipulatorPort2)));



	}
void MainApplication::defineOptions(Poco::Util::OptionSet & options)
{
    logger().information("defineOptions");
    Poco::Util::ServerApplication::defineOptions(options);

    options.addOption(
                Poco::Util::Option("help","h","display Help").
                required(false).
                repeatable(false).
                callback(Poco::Util::OptionCallback<MainApplication>(this,&MainApplication::handleHelp))
                );

    options.addOption(
                Poco::Util::Option("client","c","start client services").
                required(false).
                repeatable(false).
                group("client").
                callback(Poco::Util::OptionCallback<MainApplication>(this,&MainApplication::handleOption))
                );

    options.addOption(
                Poco::Util::Option("server","s","start server services").
                required(false).
                repeatable(false).
                group("server").
                callback(Poco::Util::OptionCallback<MainApplication>(this,&MainApplication::handleOption))
                );

}
示例#4
0
	void AggAverageApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"groupby", "g", "specify group column.").required(
				false).repeatable(false) .argument("group", true).binding(
				"smartcube.agg.average.groupby"));

		options.addOption(Poco::Util::Option(
				"showall", "a", "show all rows.").required(
				false).repeatable(false).binding(
				"smartcube.agg.average.showall"));
	}
示例#5
0
	void HeadApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"groupby", "g", "specify group columns.").required(
				false).repeatable(false) .argument("group", true).binding(
				"smartcube.agg.head.groupby"));

		options.addOption(Poco::Util::Option(
				"lines", "n", "specify the number of lines").required(
				false).repeatable(false).argument("num").binding(
				"smartcube.agg.head.lines"));
	}
示例#6
0
	void FilterApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"and", "a", "filter by and operation.").required(
				false).repeatable(false).group("filter").binding(
				"smartcube.row.filter.and"));

		options.addOption(Poco::Util::Option(
				"or", "o", "filter by or operation.").required(
				false).repeatable(false).group("filter").binding(
				"smartcube.row.filter.or"));
	}
示例#7
0
void Server::defineOptions(Poco::Util::OptionSet & _options)
{
    _options.addOption(
        Poco::Util::Option("help", "h", "show help and exit")
            .required(false)
            .repeatable(false)
            .binding("help"));
    _options.addOption(
        Poco::Util::Option("version", "V", "show version and exit")
            .required(false)
            .repeatable(false)
            .binding("version"));
    BaseDaemon::defineOptions(_options);
}
 virtual void defineOptions(Poco::Util::OptionSet &options) override {
     TwitterSubliminalApplication::defineOptions(options);
     options.addOption(Poco::Util::Option("blocksize",
                                          "o",
                                          "specify the size of a block [1,20]")
                               .required(false)
                               .argument("size")
                               .binding("blocksize"));
     options.addOption(Poco::Util::Option("output",
                                          "p",
                                          "specify file PATH for output; if omitted, output to stdout")
                               .required(false)
                               .argument("PATH")
                               .binding("output_path"));
 };
示例#9
0
void MQCheckApplication::defineOptions(Poco::Util::OptionSet& options)
{
  Application::defineOptions(options);

  options.addOption(Option("help", "h", "display help information on command line arguments").required(false).repeatable(false));
  options.addOption(Option("channel", "c", "Server-connection channel").required(false)
                                                                       .repeatable(false)
                                                                       .binding("mqcheck.options.channel")
                                                                       .argument("channelname"));
  options.addOption(Option("qmgr", "m", "Queuemanager").required(false)
                                                       .repeatable(false)
                                                       .binding("mqcheck.options.qmgr")
                                                       .argument("name"));
  options.addOption(Option("server", "s", "Host and port").required(false)
                                                          .repeatable(false)
                                                          .binding("mqcheck.options.server")
                                                          .argument("host(port)"));
  options.addOption(Option("type", "t", "Type of check").required(false)
                                                        .repeatable(false)
                                                        .binding("mqcheck.options.type")
                                                        .argument("type"));
  options.addOption(Option("object", "o", "Name of object").required(false)
                                                           .repeatable(false)
                                                           .binding("mqcheck.options.object")
                                                           .argument("name"));
  options.addOption(Option("qdepth", "qd", "Queue Depth").required(false)
                                                           .repeatable(false)
                                                           .binding("mqcheck.options.qdepth")
                                                           .argument("number"));
}
示例#10
0
	void ExpApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"base", "b", "specify base.").required(
				false).repeatable(false) .argument("base", true).binding(
				"smartcube.math.exp.base"));
	}
示例#11
0
TEST_F(PocoParser_Test, is_not_valid_when_missing_required_arguments)
{
  Poco::Util::OptionSet options;
  options.addOption(Poco::Util::Option{"test", "t", "", true});

  testee.parse({}, options);

  ASSERT_FALSE(testee.isValid());
}
示例#12
0
TEST_F(PocoParser_Test, is_not_valid_if_unknown_option_is_provided)
{
  Poco::Util::OptionSet options;
  options.addOption(Poco::Util::Option{"test", "t", "", false});

  testee.parse({"--unknown"}, options);

  ASSERT_FALSE(testee.isValid());
}
示例#13
0
  void defineOptions(Poco::Util::OptionSet& options)
  {
    Poco::Util::ServerApplication::defineOptions(options);
 
    options.addOption(
		      Poco::Util::Option("help", "h", "display help information on command line arguments")
		      .required(false)
		      .repeatable(false));
  }
示例#14
0
TEST_F(PocoParser_Test, is_not_valid_when_missing_option_argument)
{
  Poco::Util::OptionSet options;
  options.addOption(Poco::Util::Option{"test", "t", "", true}.argument("value"));

  testee.parse({"--test"}, options);

  ASSERT_FALSE(testee.isValid());
}
示例#15
0
	void StripApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"left", "l", "strip left side.").required(
				false).repeatable(false).group("strip").binding(
				"smartcube.str.strip.left"));

		options.addOption(Poco::Util::Option(
				"right", "r", "strip right side.").required(
				false).repeatable(false).group("strip").binding(
				"smartcube.str.strip.right"));

		options.addOption(Poco::Util::Option(
				"both", "b", "strip both sides. [default]").required(
				false).repeatable(false).group("strip").binding(
				"smartcube.str.strip.both"));
	}
示例#16
0
	void GtApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"numeric", "n", "compare numerics.").required(
				false).repeatable(false).group("gt").binding(
				"smartcube.log.gt.numeric"));

		options.addOption(Poco::Util::Option(
				"case-sensitive", "c", "compare strings, case sensitive.").required(
				false).repeatable(false).group("gt").binding(
				"smartcube.log.gt.string-case-sensitive"));

		options.addOption(Poco::Util::Option(
				"case-insensitive", "i", "compare strings, case insensitive.").required(
				false).repeatable(false).group("gt").binding(
				"smartcube.log.gt.string-case-insensitive"));
	}
示例#17
0
	void ReSplitApp::defineOptions(Poco::Util::OptionSet& options)
	{
		ConsoleApp::defineOptions(options);

		options.addOption(Poco::Util::Option(
				"pattern", "p", "specify RE pattern.") .required(
				false).repeatable(false).argument("pattern", true) .binding(
				"smartcube.col.resplit.pattern"));

		options.addOption(Poco::Util::Option(
				"match", "m", "use match mode. [default]") .required(
				false).repeatable(false).group("resplit") .binding(
				"smartcube.col.resplit.match"));

		options.addOption(Poco::Util::Option(
				"search", "s", "use search mode.") .required(
				false).repeatable(false).group("resplit") .binding(
				"smartcube.col.resplit.search"));
	}
示例#18
0
TEST_F(PocoParser_Test, can_check_if_flag_is_set_or_not)
{
  Poco::Util::OptionSet options;
  options.addOption(Poco::Util::Option{"hello", ""});

  testee.parse({"--hello"}, options);

  ASSERT_TRUE(testee.contains("hello"));
  ASSERT_FALSE(testee.contains("world"));
}
示例#19
0
TEST_F(PocoParser_Test, return_the_specified_value)
{
  Poco::Util::OptionSet options;
  options.addOption(Poco::Util::Option{"test", "t", "", true}.argument("value"));

  testee.parse({"--test=theValue"}, options);

  ASSERT_TRUE(testee.isValid());
  ASSERT_EQ("theValue", testee.value("test"));
}
示例#20
0
TEST_F(PocoParser_Test, show_help_when_requested)
{
  const std::string ExpectedHelp {
    "usage: \n"
    "-t, --test  \n"
  };
  Poco::Util::OptionSet options;
  options.addOption(Poco::Util::Option{"test", "t", "", false});
  testee.parse({}, options);

  testee.printHelp();

  ASSERT_EQ(ExpectedHelp, output.str());
}
示例#21
0
void BaseDaemon::defineOptions(Poco::Util::OptionSet& _options)
{
	Poco::Util::ServerApplication::defineOptions (_options);

	_options.addOption(
		Poco::Util::Option ("config-file", "C", "load configuration from a given file")
			.required (false)
			.repeatable (false)
			.argument ("<file>")
			.binding("config-file")
			);

	_options.addOption(
		Poco::Util::Option ("log-file", "L", "use given log file")
			.required (false)
			.repeatable (false)
			.argument ("<file>")
			.binding("logger.log")
			);

	_options.addOption(
		Poco::Util::Option ("errorlog-file", "E", "use given log file for errors only")
			.required (false)
			.repeatable (false)
			.argument ("<file>")
			.binding("logger.errorlog")
			);

	_options.addOption(
		Poco::Util::Option ("pid-file", "P", "use given pidfile")
			.required (false)
			.repeatable (false)
			.argument ("<file>")
			.binding("pid")
			);
}
示例#22
0
    void defineOptions(Poco::Util::OptionSet &options)
    {
        Poco::Util::Application::defineOptions(options);

        options.addOption(Poco::Util::Option("help", "h", "display argument help information")
            .required(false)
            .repeatable(false));

        options.addOption(Poco::Util::Option("system-info", "", "display system information")
            .required(false)
            .repeatable(false)
            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::printSystemInfo)));

        options.addOption(Poco::Util::Option("device-info", "", "display device information")
            .required(false)
            .repeatable(false)
            .argument("deviceType", false/*optional*/)
            .binding("deviceType"));

        options.addOption(Poco::Util::Option("plugin-tree", "", "display plugin tree")
            .required(false)
            .repeatable(false)
            .argument("pluginPath", false/*optional*/)
            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::printPluginTree)));

        options.addOption(Poco::Util::Option("proxy-server", "", "run the proxy server, tcp://bindHost:bindPort")
            .required(false)
            .repeatable(false)
            .argument("URI", false/*optional*/)
            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::proxyServer)));

        options.addOption(Poco::Util::Option("load-module", "", "test load a library module")
            .required(false)
            .repeatable(false)
            .argument("modulePath")
            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::loadModule)));

        options.addOption(Poco::Util::Option("run-topology", "", "run a topology from a JSON description")
            .required(false)
            .repeatable(false)
            .argument("inputFile")
            .binding("inputFile"));

        options.addOption(Poco::Util::Option("run-duration", "", "run the topology for the duration in seconds")
            .required(false)
            .repeatable(false)
            .argument("runDuration")
            .binding("runDuration"));

        options.addOption(Poco::Util::Option("idle-time", "",
            "The maximum allowed idle time in seconds.\n"
            "The topology will exit after all flows remain idle for the specified time in seconds. "
            "Use this option with --run-duration to specify a timeout to wait for idle to occur. "
            "PothosUtil will return an error code if the timeout is reached before idle occurs.")
            .required(false)
            .repeatable(false)
            .argument("idleTime")
            .binding("idleTime"));

        options.addOption(Poco::Util::Option("var", "",
            "Specify an arbitrary keyword + value variable\n"
            "using the format --var=name:value\n"
            "Multiple instances of --var are possible.\n"
            "Use with --run-topology to overload globals.")
            .required(false)
            .repeatable(true)
            .argument("variable")
            .binding("variable"));

        options.addOption(Poco::Util::Option("self-tests", "", "run all plugin self tests")
            .required(false)
            .repeatable(false)
            .argument("pluginPath", false/*optional*/)
            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::selfTests)));

        options.addOption(Poco::Util::Option("self-test1", "", "run a particular plugin self test")
            .required(false)
            .repeatable(false)
            .argument("pluginPath")
            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::selfTestOne)));

        options.addOption(Poco::Util::Option("success-code", "", "the success status return code (default 0)")
            .required(false)
            .repeatable(false)
            .argument("successCode")
            .validator(new Poco::Util::IntValidator(0, 255))
            .binding("successCode"));

        options.addOption(Poco::Util::Option("require-active", "", "proxy server shuts off without active clients")
            .required(false)
            .repeatable(false)
            .binding("requireActive"));

        options.addOption(Poco::Util::Option("output", "",
            "Specify an output file (used by various options)\n"
            "Use with --run-topology to dump JSON statistics.")
            .required(false)
            .repeatable(false)
            .argument("outputFile")
            .binding("outputFile"));

        options.addOption(Poco::Util::Option("doc-parse", "", "parse specified files for documentation markup")
            .required(false)
            .repeatable(false));
    }
示例#23
-1
TEST_F(PocoParser_Test, value_with_default_returns_value_if_value_exists)
{
  Poco::Util::OptionSet options;
  options.addOption(Poco::Util::Option{"test", "t", "", true}.argument("value"));

  testee.parse({"--test=hello"}, options);

  ASSERT_EQ("hello", testee.value("test", "default"));
}