276    advgetopt::define_option(
 
  277          advgetopt::Name(
"args")
 
  278        , advgetopt::ShortName(
'a')
 
  279        , advgetopt::Flags(advgetopt::command_flags<
 
  280                  advgetopt::GETOPT_FLAG_REQUIRED
 
  281                , advgetopt::GETOPT_FLAG_MULTIPLE>())
 
  283        , 
"define values in the $_csspp_args variable map" 
  286    advgetopt::define_option(
 
  287          advgetopt::Name(
"debug")
 
  288        , advgetopt::ShortName(
'd')
 
  289        , advgetopt::Flags(advgetopt::standalone_command_flags<>())
 
  290        , advgetopt::Help(
"show all messages, including @debug messages")
 
  292    advgetopt::define_option(
 
  293          advgetopt::Name(
"include")
 
  294        , advgetopt::ShortName(
'I')
 
  295        , advgetopt::Flags(advgetopt::command_flags<
 
  296                  advgetopt::GETOPT_FLAG_REQUIRED
 
  297                , advgetopt::GETOPT_FLAG_MULTIPLE>())
 
  298        , advgetopt::Help(
"specify one or more paths to various user defined CSS files; \"-\" to clear the list (i.e. \"-I -\")")
 
  300    advgetopt::define_option(
 
  301          advgetopt::Name(
"no-logo")
 
  302        , advgetopt::ShortName(
'\0')
 
  303        , advgetopt::Flags(advgetopt::standalone_command_flags<>())
 
  304        , advgetopt::Help(
"prevent the \"logo\" from appearing in the output file")
 
  306    advgetopt::define_option(
 
  307          advgetopt::Name(
"empty-on-undefined-variable")
 
  308        , advgetopt::ShortName(
'\0')
 
  309        , advgetopt::Flags(advgetopt::standalone_command_flags<>())
 
  310        , advgetopt::Help(
"if accessing an undefined variable, return an empty string, otherwise generate an error.")
 
  312    advgetopt::define_option(
 
  313          advgetopt::Name(
"output")
 
  314        , advgetopt::ShortName(
'o')
 
  315        , advgetopt::Flags(advgetopt::command_flags<
 
  316                  advgetopt::GETOPT_FLAG_REQUIRED>())
 
  317        , advgetopt::Help(
"save the results in the specified file if specified; otherwise send output to stdout.")
 
  319    advgetopt::define_option(
 
  320          advgetopt::Name(
"precision")
 
  321        , advgetopt::ShortName(
'p')
 
  322        , advgetopt::Flags(advgetopt::command_flags<
 
  323                  advgetopt::GETOPT_FLAG_REQUIRED>())
 
  324        , advgetopt::Help(
"define the number of digits to use after the decimal point, defaults to 3; note that for percent values, the precision is always 2.")
 
  326    advgetopt::define_option(
 
  327          advgetopt::Name(
"quiet")
 
  328        , advgetopt::ShortName(
'q')
 
  329        , advgetopt::Flags(advgetopt::standalone_command_flags<>())
 
  330        , advgetopt::Help(
"suppress @info and @warning messages.")
 
  332    advgetopt::define_option(
 
  333          advgetopt::Name(
"style")
 
  334        , advgetopt::ShortName(
's')
 
  335        , advgetopt::Flags(advgetopt::command_flags<
 
  336                  advgetopt::GETOPT_FLAG_REQUIRED>())
 
  337        , advgetopt::Help(
"output style: compressed, tidy, compact, expanded.")
 
  339    advgetopt::define_option(
 
  340          advgetopt::Name(
"Werror")
 
  341        , advgetopt::Flags(advgetopt::standalone_command_flags<>())
 
  342        , advgetopt::Help(
"make warnings count as errors.")
 
  344    advgetopt::define_option(
 
  345          advgetopt::Name(
"--")
 
  346        , advgetopt::Flags(advgetopt::command_flags<
 
  347                  advgetopt::GETOPT_FLAG_MULTIPLE
 
  348                , advgetopt::GETOPT_FLAG_DEFAULT_OPTION
 
  349                , advgetopt::GETOPT_FLAG_SHOW_USAGE_ON_ERROR>())
 
  350        , advgetopt::Help(
"[file.css ...]; use stdin if no filename specified.")
 
  352    advgetopt::end_options()
 
 
  359    .f_project_name = 
"csspp",
 
  360    .f_group_name = 
nullptr,
 
  362    .f_options_files_directory = 
nullptr,
 
  363    .f_environment_variable_name = 
"CSSPPFLAGS",
 
  364    .f_environment_variable_intro = 
nullptr,
 
  365    .f_section_variables_name = 
nullptr,
 
  366    .f_configuration_files = 
nullptr,
 
  367    .f_configuration_filename = 
nullptr,
 
  368    .f_configuration_directories = 
nullptr,
 
  369    .f_environment_flags = advgetopt::GETOPT_ENVIRONMENT_FLAG_PROCESS_SYSTEM_PARAMETERS,
 
  370    .f_help_header = 
"Usage: %p [-<opt>] [file.css ...] [-o out.css]\n" 
  371                     "where -<opt> is one or more of:",
 
  372    .f_help_footer = 
"%c",
 
  374    .f_license = 
"GNU GPL v2",
 
  375    .f_copyright = 
"Copyright (c) 2015-" 
  376                   BOOST_PP_STRINGIZE(UTC_BUILD_YEAR)
 
  377                   " by Made to Order Software Corporation -- All Rights Reserved",
 
 
  425    std::unique_ptr<std::stringstream> ss;
 
  429    if(
f_opt.is_defined(
"--"))
 
  432        int const arg_count(
f_opt.size(
"--"));
 
  434        && 
f_opt.get_string(
"--") == 
"-")
 
  442            std::unique_ptr<char, void (*)(
char *)> cwd(get_current_dir_name(), 
free_char);
 
  443            ss.reset(
new std::stringstream);
 
  445            for(
int idx(0); idx < arg_count; ++idx)
 
  448                std::string filename(
f_opt.get_string(
"--", idx));
 
  452                            << 
"You cannot include a file with an empty name." 
  459                            << 
"You cannot currently mix files and stdin. You may use @import \"filename\"; in your stdin data though." 
  463                if(filename[0] == 
'/')
 
  466                    *ss << 
"@import \"" << filename << 
"\";\n";
 
  471                    *ss << 
"@import \"" << cwd.get() << 
"/" << filename << 
"\";\n";
 
  495    args_var->set_string(
"_csspp_args");
 
  498    wrapper->add_child(array);
 
  499    csspp_args->add_child(args_var);
 
  500    csspp_args->add_child(wrapper);
 
  501    if(
f_opt.is_defined(
"args"))
 
  503        int const count(
f_opt.size(
"args"));
 
  504        for(
int idx(0); idx < count; ++idx)
 
  507            arg->set_string(
f_opt.get_string(
"args", idx));
 
  508            array->add_child(arg);
 
  511    root->set_variable(
"_csspp_args", csspp_args);
 
  519    if(
f_opt.is_defined(
"include"))
 
  521        std::size_t 
const count(
f_opt.size(
"include"));
 
  522        for(std::size_t idx(0); idx < count; ++idx)
 
  524            std::string 
const path(
f_opt.get_string(
"include", idx));
 
  536    if(
f_opt.is_defined(
"no-logo"))
 
  541    if(
f_opt.is_defined(
"empty-on-undefined-variable"))
 
  553    if(
f_opt.is_defined(
"style"))
 
  555        std::string 
const mode(
f_opt.get_string(
"style"));
 
  556        if(mode == 
"compressed")
 
  560        else if(mode == 
"tidy")
 
  564        else if(mode == 
"compact")
 
  568        else if(mode == 
"expanded")
 
  575                    << 
"The output mode \"" 
  577                    << 
"\" is not supported. Try one of: compressed, tidy, compact, expanded instead." 
  583    std::ostream * out(
nullptr);
 
  584    bool user_output(
false);
 
  585    std::string output_filename;
 
  586    if(
f_opt.is_defined(
"output"))
 
  588        output_filename = 
f_opt.get_string(
"output");
 
  589        user_output = output_filename != 
"-";
 
  593        out = 
new std::ofstream(output_filename);