Ignore:
Timestamp:
05/13/11 15:48:57 (14 years ago)
Author:
tbretz
Message:
Use the functionality of boost program_options better; implemented po_bool() as a special po_switch() case; added some comments.
File:
1 edited

Legend:

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

    r10683 r10707  
    1313    config.add_options()
    1414        ("dns",               var<string>("localhost"),  "Dim nameserver host name (Overwites DIM_DNS_NODE environment variable)")
    15         ("schedule-database", var<string>(), "Database name for scheduling preview")
     15        ("schedule-database", var<string>()->required(), "Database name for scheduling preview")
    1616        ;
    1717
     
    6464        vm = conf.Parse(argc, argv);
    6565    }
     66#if BOOST_VERSION > 104000
     67    catch (po::multiple_occurrences &e)
     68    {
     69        cout << "Error: " << e.what() << " of '" << e.get_option_name() << "' option." << endl;
     70        cout << endl;
     71        return -1;
     72    }
     73#endif
    6674    catch (std::exception &e)
    6775    {
    68 #if BOOST_VERSION > 104000
    69         po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
    70         if (MO)
    71             cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
    72         else
    73 #endif
    74             cout << "Error: " << e.what() << endl;
     76        cout << "Error: " << e.what() << endl;
    7577        cout << endl;
    7678
     
    9395    }
    9496
    95     if (!conf.Has("schedule-database"))
    96     {
    97         cout << "Please provide which database you want to use for scheduling using --schedule-database=<dbname>." << endl;
    98         return -1;
    99     }
    100 
    10197    const char* dbname = conf.Get<string>("schedule-database").c_str();
    10298
Note: See TracChangeset for help on using the changeset viewer.