Changeset 15086


Ignore:
Timestamp:
Mar 18, 2013, 2:35:28 PM (7 years ago)
Author:
tbretz
Message:
Unify dimctrl and 'dimserver' (dimctrl --server)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/dimctrl.cc

    r15021 r15086  
    1111int RunShell(Configuration &conf)
    1212{
    13     StateMachineDimControl::fIsServer = conf.Get<bool>("server");
     13    StateMachineDimControl::fIsServer = conf.GetName()=="dimserver";
    1414    return Main::execute<T, StateMachineDimControl>(conf);
    1515}
     
    1717void SetupConfiguration(Configuration &conf)
    1818{
    19     po::options_description control("Dim control options");
     19    po::options_description control("Options ("+conf.GetName()+")");
    2020    control.add_options()
    21         ("server",       po_bool(false),  "Start dimctrl as a dim server (console mode switched off)")
    22         ("force-console",po_switch(),     "Forces console mode in server-mode.")
    23         ("debug",        po_bool(false),  "Print the labels for debugging purpose")
    24         ("start",        var<string>(),   "Start a java script with the given name on the dimctrl-server")
    25         ("batch",        var<string>(),   "Start a batch script with the given name at the given label (script.dim[:N]) on the dimctrl-server")
    26         ("stop",         po_switch(),     "Stop a currently running script on the dimctrl-server")
    27         ("restart",      var<string>(),   "Send 'EXIT 126' to the given server")
    28         ("msg",          var<string>(),   "Send a message to the chat server.")
    29         ("user,u",       var<string>(""), "A user name - just for logging purposes (default is ${USER})")
    30         ("JavaScript.*", var<string>(""), "Additional arguments which are provided to JavaScripts started in a dimctrl server via the START command")
     21        ("force-console", po_switch(),     "Forces console mode in server-mode.")
     22        ("debug",         po_bool(false),  "Print the labels for debugging purpose")
     23        ("user,u",        var<string>(""), "A user name - just for logging purposes (default is ${USER})")
     24        ("JavaScript.*",  var<string>(""), "Additional arguments which are provided to JavaScripts started in a dimctrl server via the START command")
    3125        ;
     26
     27    if (conf.GetName()!="dimserver")
     28    {
     29        control.add_options()
     30            ("start",   var<string>(), "Start a java script with the given name on the dimctrl-server")
     31            ("batch",   var<string>(), "Start a batch script with the given name at the given label (script.dim[:N]) on the dimctrl-server")
     32            ("stop",    po_switch(),   "Stop a currently running script on the dimctrl-server")
     33            ("restart", var<string>(), "Send 'EXIT 126' to the given server")
     34            ("msg",     var<string>(), "Send a message to the chat server.")
     35            ;
     36    }
    3237
    3338    conf.AddEnv("user", "USER");
     
    5156        "\n"
    5257        "The program can be started as a dim server, so that it is visible "
    53         "in the dm network to other clients. If started as a client, it can "
    54         "only interact passively with the dim network. The usual case should "
    55         "be to have one server running and control it from a dimctrl started "
    56         "as client.\n"
     58        "in the dim network to other clients. If started as a client (dimctrl), "
     59        "it can only interact passively with the dim network. The usual case "
     60        "should be to have one server running (dimserver) and control it from "
     61        "a dimctrl started.\n"
    5762        "\n"
    58         "Usage: dimctrl [--server|-c type] [OPTIONS]\n"
    59         "  or:  dimctrl [OPTIONS]\n";
     63        "Usage: dimctrl [-c type] [OPTIONS]\n"
     64        "  or:  dimctrl [OPTIONS]\n"
     65        "  or:  dimserver [OPTIONS]\n";
    6066    cout << endl;
    6167}
     
    96102        throw runtime_error("--force-console must be used with --console/-c");
    97103
    98     if (conf.Get<bool>("server") && !conf.Get<bool>("force-console"))
     104    if (conf.GetName()=="dimserver" && !conf.Get<bool>("force-console"))
    99105        conf.Remove("console");
    100106
Note: See TracChangeset for help on using the changeset viewer.