Changeset 1015 for trunk/bin


Ignore:
Timestamp:
Jan 9, 2010, 3:16:03 PM (12 years ago)
Author:
Peter Johansson
Message:

closes #438. adding an option --format

Location:
trunk/bin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/Parameter.cc

    r978 r1015  
    6363                    std::string("ignore cache files and analyze ") +
    6464                    std::string("everything from repository")),
     65      format_(cmd_,"format", "override image format defined in config file"),
    6566      report_(cmd_, "report", "create no HTML report", true),
    6667      revisions_(cmd_, "revisions",
     
    219220
    220221
     222  const yat::utility::OptionArg<std::string>&
     223  Parameter::format(void) const
     224  {
     225    return format_;
     226  }
     227
     228
    221229  void Parameter::init(void)
    222230  {
     
    224232    cmd_.program_name() = PACKAGE_NAME;
    225233    config_file_.print_arg("=FILE");
     234    format_.print_arg("=FMT");
    226235    root_.print_arg("=ROOT");
    227236    target_.print_arg("=TARGET");
  • trunk/bin/Parameter.h

    r978 r1015  
    5555    bool generate_config(void) const ;
    5656    bool ignore_cache(void) const;
     57    const yat::utility::OptionArg<std::string>& format(void) const;
    5758    bool report(void) const;
    5859    bool revisions(void) const;
     
    8182    yat::utility::OptionHelp help_;
    8283    yat::utility::OptionSwitch ignore_cache_;
     84    yat::utility::OptionArg<std::string> format_;
    8385    yat::utility::OptionSwitch report_;
    8486    yat::utility::OptionSwitch revisions_;
  • trunk/bin/svndigest.cc

    r978 r1015  
    3737
    3838#include "yat/Exception.h"
     39#include "yat/OptionArg.h"
    3940
    4041#include <cassert>
     
    8182      config.load(is);
    8283    }
    83     catch (std::runtime_error e) {
     84    catch (std::runtime_error& e) {
    8485      std::cerr << "svndigest: invalid config file\n"
    8586                << e.what() << std::endl;
     
    8788    }
    8889    is.close();
     90  }
     91
     92  // set values from commandline into config object
     93  try {
     94    if (option->format().present())
     95      Configuration::instance().image_format(option->format().value());
     96  }
     97  catch (std::runtime_error& e) {
     98    std::cerr << PACKAGE_NAME ": invalid argument `"
     99              << option->format().value() << "' for `--"
     100              << option->format().long_name() << "'\n"
     101              << e.what() << "\n"
     102              << "Try `" << PACKAGE_NAME << " --help' for more information.\n";
     103    exit(EXIT_FAILURE);
    89104  }
    90105 
Note: See TracChangeset for help on using the changeset viewer.