예제 #1
0
void TimeUnitBehavior::optionsFinishing(Options *options)
{
    double factor = TimeUnitManager(timeUnit()).timeScaleFactor();
    TimeOptionScaler<DoubleOptionInfo>(factor).visitSubSection(options);
    TimeOptionScaler<FloatOptionInfo>(factor).visitSubSection(options);
    if (timeUnitStore_ != NULL)
    {
        *timeUnitStore_ = static_cast<TimeUnit>(timeUnit_);
    }
}
예제 #2
0
void CommandLineHelpWriter::writeHelp(const CommandLineHelpContext &context)
{
    if (context.isCompletionExport())
    {
        context.shellCompletionWriter().writeModuleCompletions(
                context.moduleDisplayName(), impl_->options_);
        return;
    }
    const HelpWriterContext &writerContext = context.writerContext();
    OptionsFilter            filter;
    filter.setShowHidden(context.showHidden());

    {
        writerContext.writeTitle("Synopsis");
        SynopsisFormatter synopsisFormatter(writerContext);
        synopsisFormatter.start(context.moduleDisplayName());
        filter.formatSelected(OptionsFilter::eSelectInputFileOptions,
                              &synopsisFormatter, impl_->options_);
        filter.formatSelected(OptionsFilter::eSelectInputOutputFileOptions,
                              &synopsisFormatter, impl_->options_);
        filter.formatSelected(OptionsFilter::eSelectOutputFileOptions,
                              &synopsisFormatter, impl_->options_);
        filter.formatSelected(OptionsFilter::eSelectOtherOptions,
                              &synopsisFormatter, impl_->options_);
        synopsisFormatter.finish();
    }

    if (!impl_->helpText_.empty())
    {
        writerContext.writeTitle("Description");
        writerContext.writeTextBlock(impl_->helpText_);
    }
    CommonFormatterData    common(TimeUnitManager().timeUnitAsString());
    OptionsListFormatter   formatter(writerContext, common, "Options");
    formatter.startSection("Options to specify input files:");
    filter.formatSelected(OptionsFilter::eSelectInputFileOptions,
                          &formatter, impl_->options_);
    formatter.finishSection();
    formatter.startSection("Options to specify input/output files:");
    filter.formatSelected(OptionsFilter::eSelectInputOutputFileOptions,
                          &formatter, impl_->options_);
    formatter.finishSection();
    formatter.startSection("Options to specify output files:");
    filter.formatSelected(OptionsFilter::eSelectOutputFileOptions,
                          &formatter, impl_->options_);
    formatter.finishSection();
    formatter.startSection("Other options:");
    filter.formatSelected(OptionsFilter::eSelectOtherOptions,
                          &formatter, impl_->options_);
    formatter.finishSection();

    impl_->formatBugs(writerContext);
}
CommandLineHelpWriter::Impl::Impl(const Options &options)
    : options_(options), timeUnit_(TimeUnitManager().timeUnitAsString())
{
}