From 0eb3ea72536c116205b2e59bf8f3cac3baa12d36 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 21 Nov 2018 08:22:57 +0100 Subject: [PATCH] Auto-generate CLI help (includes some refactoring to ConfigDef and ConfigOptionDef) --- src/GUI/GUI.cpp | 7 +- src/GUI/GUI.hpp | 1 + src/slic3r.cpp | 45 +++-- src/slic3r.hpp | 2 +- xs/src/libslic3r/Config.cpp | 2 +- xs/src/libslic3r/ConfigBase.cpp | 223 ++++++++++++++++++------- xs/src/libslic3r/ConfigBase.hpp | 8 +- xs/src/libslic3r/PlaceholderParser.cpp | 4 +- xs/src/libslic3r/PrintConfig.cpp | 69 +++----- xs/src/libslic3r/PrintConfig.hpp | 5 - 10 files changed, 233 insertions(+), 133 deletions(-) diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 912f68ac0..ac8b11aca 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -25,10 +25,11 @@ bool App::OnInit() { this->SetAppName("Slic3r"); this->notifier = std::unique_ptr(); - - datadir = decode_path(wxStandardPaths::Get().GetUserDataDir()); + + if (datadir.empty()) + datadir = decode_path(wxStandardPaths::Get().GetUserDataDir()); wxString enc_datadir = encode_path(datadir); - + const wxString& slic3r_ini {datadir + "/slic3r.ini"}; this->preset_ini[static_cast(preset_t::Print)] = {datadir + "/print"}; this->preset_ini[static_cast(preset_t::Printer)] = {datadir + "/printer"}; diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index dd26439a2..b0bad5d48 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -42,6 +42,7 @@ private: void load_presets(); + wxString autosave {""}; wxString datadir {""}; const std::string LogChannel {"APP"}; //< Which log these messages should go to. diff --git a/src/slic3r.cpp b/src/slic3r.cpp index ebdebf9ab..880b9fb51 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -245,6 +245,8 @@ int CLI::run(int argc, char **argv) { for (auto const &opt_key : this->actions) { if (opt_key == "help") { this->print_help(); + } else if (opt_key == "help_options") { + this->print_help(true); } else if (opt_key == "save") { this->print_config.save(config.getString("save")); } else if (opt_key == "info") { @@ -317,7 +319,8 @@ int CLI::run(int argc, char **argv) { if (actions.empty()) { #ifdef USE_WX GUI::App *gui = new GUI::App(); - + gui->autosave = this->config.getString("autosave"); + gui->datadir = this->config.getString("datadir"); GUI::App::SetInstance(gui); wxEntry(argc, argv); #else @@ -329,19 +332,33 @@ int CLI::run(int argc, char **argv) { } void -CLI::print_help() const { - std::cout << "Slic3r " << SLIC3R_VERSION << " is a STL-to-GCODE translator for RepRap 3D printers" << "\n" - << "written by Alessandro Ranellucci & the Slic3r community - https://slic3r.org/ - https://github.com/slic3r/Slic3r" << "\n" - << "Git Version " << BUILD_COMMIT << "\n\n" - << "Usage (C++ only): ./slic3r [ OPTIONS ] [ file.stl ] [ file2.stl ] ..." << "\n"; - // CLI Options - std::cout << "** CLI OPTIONS **\n"; - print_cli_options(boost::nowide::cout); - std::cout << "****\n"; - // Print options - std::cout << "** PRINT OPTIONS **\n"; - print_print_options(boost::nowide::cout); - std::cout << "****\n"; +CLI::print_help(bool include_print_options) const { + boost::nowide::cout + << "Slic3r " << SLIC3R_VERSION << " (build commit: " << BUILD_COMMIT << ")" << std::endl + << "https://slic3r.org/ - https://github.com/slic3r/Slic3r" << std::endl << std::endl + << "Usage: slic3r [ ACTIONS ] [ TRANSFORM ] [ OPTIONS ] [ file.stl ... ]" << std::endl + << std::endl + << "Actions:" << std::endl; + cli_actions_config_def.print_cli_help(boost::nowide::cout, false); + + boost::nowide::cout + << std::endl + << "Transform options:" << std::endl; + cli_transform_config_def.print_cli_help(boost::nowide::cout, false); + + boost::nowide::cout + << std::endl + << "Other options:" << std::endl; + cli_misc_config_def.print_cli_help(boost::nowide::cout, false); + + if (include_print_options) { + boost::nowide::cout << std::endl; + print_config_def.print_cli_help(boost::nowide::cout, true); + } else { + boost::nowide::cout + << std::endl + << "Run --help-options to see the full listing of print/G-code options." << std::endl; + } } void diff --git a/src/slic3r.hpp b/src/slic3r.hpp index 6787710ab..f22cc4794 100644 --- a/src/slic3r.hpp +++ b/src/slic3r.hpp @@ -19,7 +19,7 @@ class CLI { t_config_option_keys input_files, actions, transforms; std::vector models; - void print_help() const; + void print_help(bool include_print_options = false) const; void export_models(IO::ExportFormat format); std::string output_filepath(const Model &model, IO::ExportFormat format) const; }; diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp index fc46a014c..d3cb341df 100644 --- a/xs/src/libslic3r/Config.cpp +++ b/xs/src/libslic3r/Config.cpp @@ -25,7 +25,7 @@ Config::new_from_defaults(t_config_option_keys init) auto my_config(std::make_shared()); for (auto& opt_key : init) { if (print_config_def.has(opt_key)) { - const std::string value { print_config_def.get(opt_key)->default_value->serialize() }; + const std::string value { print_config_def.get(opt_key).default_value->serialize() }; my_config->_config.set_deserialize(opt_key, value); } } diff --git a/xs/src/libslic3r/ConfigBase.cpp b/xs/src/libslic3r/ConfigBase.cpp index f1c8ddc30..d28ebc243 100644 --- a/xs/src/libslic3r/ConfigBase.cpp +++ b/xs/src/libslic3r/ConfigBase.cpp @@ -3,7 +3,9 @@ #include #include #include +#include #include // std::runtime_error +#include #include #include #include @@ -208,6 +210,16 @@ ConfigOptionDef::~ConfigOptionDef() delete this->default_value; } +std::vector +ConfigOptionDef::cli_args() const +{ + std::string cli = this->cli.substr(0, this->cli.find("=")); + boost::trim_right_if(cli, boost::is_any_of("!")); + std::vector args; + boost::split(args, cli, boost::is_any_of("|")); + return args; +} + ConfigOptionDef* ConfigDef::add(const t_config_option_key &opt_key, ConfigOptionType type) { @@ -229,11 +241,12 @@ ConfigDef::has(const t_config_option_key &opt_key) const return this->options.count(opt_key) > 0; } -const ConfigOptionDef* +const ConfigOptionDef& ConfigDef::get(const t_config_option_key &opt_key) const { - if (this->options.count(opt_key) == 0) return NULL; - return &const_cast(this)->options[opt_key]; + if (this->options.count(opt_key) == 0) + throw UnknownOptionException(opt_key); + return this->options.at(opt_key); } void @@ -242,6 +255,102 @@ ConfigDef::merge(const ConfigDef &other) this->options.insert(other.options.begin(), other.options.end()); } +std::ostream& +ConfigDef::print_cli_help(std::ostream& out, bool show_defaults) const +{ + // prepare a function for wrapping text + auto wrap = [](std::string text, size_t line_length) -> std::string { + std::istringstream words(text); + std::ostringstream wrapped; + std::string word; + + if (words >> word) { + wrapped << word; + size_t space_left = line_length - word.length(); + while (words >> word) { + if (space_left < word.length() + 1) { + wrapped << '\n' << word; + space_left = line_length - word.length(); + } else { + wrapped << ' ' << word; + space_left -= word.length() + 1; + } + } + } + return wrapped.str(); + }; + + // get the unique categories + std::set categories; + for (const auto& opt : this->options) { + const ConfigOptionDef& def = opt.second; + categories.insert(def.category); + } + + for (auto category : categories) { + if (category != "") { + out << category << ":" << std::endl; + } else if (categories.size() > 1) { + out << "Misc options:" << std::endl; + } + + for (const auto& opt : this->options) { + const ConfigOptionDef& def = opt.second; + if (def.category != category) continue; + + if (!def.cli.empty()) { + // get all possible variations: --foo, --foobar, -f... + auto cli_args = def.cli_args(); + for (auto& arg : cli_args) { + arg.insert(0, (arg.size() == 1) ? "-" : "--"); + if (def.type == coFloat || def.type == coInt || def.type == coFloatOrPercent + || def.type == coFloats || def.type == coInts) { + arg += " N"; + } else if (def.type == coPoint) { + arg += " X,Y"; + } else if (def.type == coPoint3) { + arg += " X,Y,Z"; + } else if (def.type == coString || def.type == coStrings) { + arg += " ABCD"; + } + } + + // left: command line options + const std::string cli = boost::algorithm::join(cli_args, ", "); + out << " " << std::left << std::setw(20) << cli; + + // right: option description + std::string descr = def.tooltip; + if (show_defaults && def.default_value != nullptr && def.type != coBool + && (def.type != coString || !def.default_value->serialize().empty())) { + descr += " ("; + if (!def.sidetext.empty()) { + descr += def.sidetext + ", "; + } else if (!def.enum_values.empty()) { + descr += boost::algorithm::join(def.enum_values, ", ") + "; "; + } + descr += "default: " + def.default_value->serialize() + ")"; + } + + // wrap lines of description + descr = wrap(descr, 80); + std::vector lines; + boost::split(lines, descr, boost::is_any_of("\n")); + + // if command line options are too long, print description in new line + for (size_t i = 0; i < lines.size(); ++i) { + if (i == 0 && cli.size() > 19) + out << std::endl; + if (i > 0 || cli.size() > 19) + out << std::string(21, ' '); + out << lines[i] << std::endl; + } + } + } + } + return out; +} + bool ConfigBase::has(const t_config_option_key &opt_key) const { return this->option(opt_key) != NULL; @@ -314,27 +423,26 @@ ConfigBase::serialize(const t_config_option_key &opt_key) const { bool ConfigBase::set_deserialize(t_config_option_key opt_key, std::string str, bool append) { - const ConfigOptionDef* optdef = this->def->get(opt_key); - if (optdef == NULL) { + if (!this->def->has(opt_key)) { // If we didn't find an option, look for any other option having this as an alias. for (const auto &opt : this->def->options) { - for (const t_config_option_key &opt_key2 : opt.second.aliases) { - if (opt_key2 == opt_key) { - opt_key = opt_key2; - optdef = &opt.second; + for (const t_config_option_key& alias : opt.second.aliases) { + if (alias == opt_key) { + opt_key = alias; break; } } - if (optdef != NULL) break; } - if (optdef == NULL) - throw UnknownOptionException(opt_key); } + if (!this->def->has(opt_key)) { + throw UnknownOptionException(opt_key); - if (!optdef->shortcut.empty()) { - for (const t_config_option_key &shortcut : optdef->shortcut) { - if (!this->set_deserialize(shortcut, str)) return false; - } + const ConfigOptionDef& optdef = this->def->options.at(opt_key); + if (!optdef.shortcut.empty()) + for (const t_config_option_key& shortcut : optdef.shortcut) + if (!this->set_deserialize(shortcut, str)) + return false; + return true; } @@ -350,11 +458,11 @@ ConfigBase::get_abs_value(const t_config_option_key &opt_key) const { const ConfigOption* opt = this->option(opt_key); if (const ConfigOptionFloatOrPercent* optv = dynamic_cast(opt)) { // get option definition - const ConfigOptionDef* def = this->def->get(opt_key); - assert(def != NULL); + assert(this->def->has(opt_key)); + const ConfigOptionDef& def = this->def->get(opt_key); // compute absolute value over the absolute value of the base option - return optv->get_abs_value(this->get_abs_value(def->ratio_over)); + return optv->get_abs_value(this->get_abs_value(def.ratio_over)); } else if (const ConfigOptionFloat* optv = dynamic_cast(opt)) { return optv->value; } else { @@ -468,24 +576,24 @@ ConfigBase::validate() const { for (auto &opt_key : this->keys()) { // get option definition - const ConfigOptionDef* def = this->def->get(opt_key); - assert(def != nullptr); + assert(this->def->has(opt_key)); + const ConfigOptionDef& def = this->def->get(opt_key); - if (def->type == coInt) { + if (def.type == coInt) { auto &value = this->opt(opt_key)->value; - if (value < def->min || value > def->max) + if (value < def.min || value > def.max) throw InvalidOptionException(opt_key); - } else if (def->type == coFloat) { + } else if (def.type == coFloat) { auto &value = this->opt(opt_key)->value; - if (value < def->min || value > def->max) + if (value < def.min || value > def.max) throw InvalidOptionException(opt_key); - } else if (def->type == coInts) { + } else if (def.type == coInts) { for (auto &value : this->opt(opt_key)->values) - if (value < def->min || value > def->max) + if (value < def.min || value > def.max) throw InvalidOptionException(opt_key); - } else if (def->type == coFloats) { + } else if (def.type == coFloats) { for (auto &value : this->opt(opt_key)->values) - if (value < def->min || value > def->max) + if (value < def.min || value > def.max) throw InvalidOptionException(opt_key); } // TODO: validate coFloatOrPercent (semantics of min/max are ambiguous for it) @@ -521,40 +629,40 @@ ConfigOption* DynamicConfig::optptr(const t_config_option_key &opt_key, bool create) { if (this->options.count(opt_key) == 0) { if (create) { - const ConfigOptionDef* optdef = this->def->get(opt_key); - if (optdef == NULL) return NULL; + if (!this->def->has(opt_key)) return nullptr; + const ConfigOptionDef& optdef = this->def->options.at(opt_key); ConfigOption* opt; - if (optdef->default_value != nullptr) { - opt = optdef->default_value->clone(); - } else if (optdef->type == coFloat) { + if (optdef.default_value != nullptr) { + opt = optdef.default_value->clone(); + } else if (optdef.type == coFloat) { opt = new ConfigOptionFloat (); - } else if (optdef->type == coFloats) { + } else if (optdef.type == coFloats) { opt = new ConfigOptionFloats (); - } else if (optdef->type == coInt) { + } else if (optdef.type == coInt) { opt = new ConfigOptionInt (); - } else if (optdef->type == coInts) { + } else if (optdef.type == coInts) { opt = new ConfigOptionInts (); - } else if (optdef->type == coString) { + } else if (optdef.type == coString) { opt = new ConfigOptionString (); - } else if (optdef->type == coStrings) { + } else if (optdef.type == coStrings) { opt = new ConfigOptionStrings (); - } else if (optdef->type == coPercent) { + } else if (optdef.type == coPercent) { opt = new ConfigOptionPercent (); - } else if (optdef->type == coFloatOrPercent) { + } else if (optdef.type == coFloatOrPercent) { opt = new ConfigOptionFloatOrPercent (); - } else if (optdef->type == coPoint) { + } else if (optdef.type == coPoint) { opt = new ConfigOptionPoint (); - } else if (optdef->type == coPoint3) { + } else if (optdef.type == coPoint3) { opt = new ConfigOptionPoint3 (); - } else if (optdef->type == coPoints) { + } else if (optdef.type == coPoints) { opt = new ConfigOptionPoints (); - } else if (optdef->type == coBool) { + } else if (optdef.type == coBool) { opt = new ConfigOptionBool (); - } else if (optdef->type == coBools) { + } else if (optdef.type == coBools) { opt = new ConfigOptionBools (); - } else if (optdef->type == coEnum) { + } else if (optdef.type == coEnum) { ConfigOptionEnumGeneric* optv = new ConfigOptionEnumGeneric (); - optv->keys_map = &optdef->enum_keys_map; + optv->keys_map = &optdef.enum_keys_map; opt = static_cast(optv); } else { throw std::runtime_error("Unknown option type"); @@ -610,15 +718,9 @@ DynamicConfig::read_cli(int argc, char** argv, t_config_option_keys* extra, t_co { // cache the CLI option => opt_key mapping std::map opts; - for (const auto &oit : this->def->options) { - std::string cli = oit.second.cli; - cli = cli.substr(0, cli.find("=")); - boost::trim_right_if(cli, boost::is_any_of("!")); - std::vector tokens; - boost::split(tokens, cli, boost::is_any_of("|")); - for (const std::string &t : tokens) + for (const auto &oit : this->def->options) + for (auto t : this->def->get(oit.first).cli_args()) opts[t] = oit.first; - } bool parse_options = true; for (int i = 1; i < argc; ++i) { @@ -711,12 +813,9 @@ StaticConfig::set_defaults() { // use defaults from definition if (this->def == NULL) return; - t_config_option_keys keys = this->keys(); - for (t_config_option_keys::const_iterator it = keys.begin(); it != keys.end(); ++it) { - const ConfigOptionDef* def = this->def->get(*it); - if (def->default_value != nullptr) - this->option(*it)->set(*def->default_value); - } + for (auto opt_key : this->keys()) + if (this->def->has(opt_key)) + this->option(opt_key)->set(*this->def->options.at(opt_key).default_value); } t_config_option_keys diff --git a/xs/src/libslic3r/ConfigBase.hpp b/xs/src/libslic3r/ConfigBase.hpp index a784640bf..1e77382a5 100644 --- a/xs/src/libslic3r/ConfigBase.hpp +++ b/xs/src/libslic3r/ConfigBase.hpp @@ -662,6 +662,9 @@ class ConfigOptionDef ConfigOptionDef(const ConfigOptionDef &other); ~ConfigOptionDef(); + /// Returns the alternative CLI arguments for the given option. + std::vector cli_args() const; + private: ConfigOptionDef& operator= (ConfigOptionDef other); }; @@ -681,8 +684,11 @@ class ConfigDef ConfigOptionDef* add(const t_config_option_key &opt_key, ConfigOptionType type); ConfigOptionDef* add(const t_config_option_key &opt_key, const ConfigOptionDef &def); bool has(const t_config_option_key &opt_key) const; - const ConfigOptionDef* get(const t_config_option_key &opt_key) const; + const ConfigOptionDef& get(const t_config_option_key &opt_key) const; void merge(const ConfigDef &other); + + /// Iterate through all of the CLI options and write them to a stream. + std::ostream& print_cli_help(std::ostream& out, bool show_defaults = true) const; }; /// An abstract configuration store. diff --git a/xs/src/libslic3r/PlaceholderParser.cpp b/xs/src/libslic3r/PlaceholderParser.cpp index f119df888..ebd359557 100644 --- a/xs/src/libslic3r/PlaceholderParser.cpp +++ b/xs/src/libslic3r/PlaceholderParser.cpp @@ -81,8 +81,8 @@ void PlaceholderParser::apply_config(const DynamicConfig &config) t_config_option_keys opt_keys = config.keys(); for (t_config_option_keys::const_iterator i = opt_keys.begin(); i != opt_keys.end(); ++i) { const t_config_option_key &opt_key = *i; - const ConfigOptionDef* def = config.def->get(opt_key); - if (def->multiline) continue; + const ConfigOptionDef& def = config.def->get(opt_key); + if (def.multiline) continue; const ConfigOption* opt = config.option(opt_key); if (const ConfigOptionVectorBase* optv = dynamic_cast(opt)) { diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 75cc75dc6..9796f35b1 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -35,7 +35,7 @@ PrintConfigDef::PrintConfigDef() def->category = __TRANS("Layers and Perimeters"); def->tooltip = __TRANS("Controls the quality / printing time tradeoff for adaptive layer generation. 0 -> fastest printing with max layer height, 100 -> highest quality, min layer height"); def->sidetext = "%"; - def->cli = "adaptive_slicing_quality=f"; + def->cli = "adaptive-slicing-quality=f"; def->min = 0; def->max = 100; def->gui_type = "slider"; @@ -51,6 +51,7 @@ PrintConfigDef::PrintConfigDef() def = this->add("bed_shape", coPoints); def->label = __TRANS("Bed shape"); + def->tooltip = __TRANS("Shape of the print bed."); { ConfigOptionPoints* opt = new ConfigOptionPoints(); opt->values.push_back(Pointf(0,0)); @@ -196,7 +197,7 @@ PrintConfigDef::PrintConfigDef() def = this->add("disable_fan_first_layers", coInt); def->label = __TRANS("Disable fan for the first"); - def->tooltip = __TRANS("This disables the fan completely for the first N layers to aid in the adhesion of media to the bed. (default 3)"); + def->tooltip = __TRANS("This disables the fan completely for the first N layers to aid in the adhesion of media to the bed."); def->sidetext = __TRANS("layers"); def->cli = "disable-fan-first-layers=i"; def->min = 0; @@ -1032,7 +1033,7 @@ PrintConfigDef::PrintConfigDef() def = this->add("pressure_advance", coFloat); def->label = __TRANS("Pressure advance"); - def->category = __TRANS("Extruder"); + def->category = __TRANS("Extruders"); def->tooltip = __TRANS("When set to a non-zero value, this experimental option enables pressure regulation. It's the K constant for the advance algorithm that pushes more or less filament upon speed changes. It's useful for Bowden-tube extruders. Reasonable values are in range 0-10."); def->cli = "pressure-advance=f"; def->min = 0; @@ -1942,12 +1943,12 @@ CLIActionsConfigDef::CLIActionsConfigDef() def = this->add("help", coBool); def->label = __TRANS("Help"); def->tooltip = __TRANS("Show this help."); - def->cli = "help"; + def->cli = "help|h"; def->default_value = new ConfigOptionBool(false); def = this->add("help_options", coBool); def->label = __TRANS("Help (options)"); - def->tooltip = __TRANS("Show the list of configuration options."); + def->tooltip = __TRANS("Show the full list of print/G-code configuration options."); def->cli = "help-options"; def->default_value = new ConfigOptionBool(false); @@ -2016,15 +2017,10 @@ CLITransformConfigDef::CLITransformConfigDef() def->cli = "duplicate=i"; def->min = 1; - def = this->add("duplicate_grid", coInts); + def = this->add("duplicate_grid", coPoint); def->label = __TRANS("Duplicate by grid"); def->tooltip = __TRANS("Multiply copies by creating a grid."); - def->cli = "duplicate-grid=i@"; - - def = this->add("load", coStrings); - def->label = __TRANS("Load config file"); - def->tooltip = __TRANS("Load configuration from the specified file. It can be used more than once to load options from multiple files."); - def->cli = "load"; + def->cli = "duplicate-grid"; def = this->add("merge", coBool); def->label = __TRANS("Merge"); @@ -2082,46 +2078,31 @@ CLIMiscConfigDef::CLIMiscConfigDef() def->tooltip = __TRANS("Do not fail if a file supplied to --load does not exist."); def->cli = "ignore-nonexistent-config"; + def = this->add("load", coStrings); + def->label = __TRANS("Load config file"); + def->tooltip = __TRANS("Load configuration from the specified file. It can be used more than once to load options from multiple files."); + def->cli = "load"; + def = this->add("output", coString); def->label = __TRANS("Output File"); def->tooltip = __TRANS("The file where the output will be written (if not specified, it will be based on the input file)."); def->cli = "output"; + + #ifdef USE_WX + def = this->add("autosave", coString); + def->label = __TRANS("Autosave"); + def->tooltip = __TRANS("Automatically export current configuration to the specified file."); + def->cli = "autosave"; + + def = this->add("datadir", coString); + def->label = __TRANS("Data directory"); + def->tooltip = __TRANS("Load and store settings at the given directory. This is useful for maintaining different profiles or including configurations from a network storage."); + def->cli = "datadir"; + #endif } const CLIActionsConfigDef cli_actions_config_def; const CLITransformConfigDef cli_transform_config_def; const CLIMiscConfigDef cli_misc_config_def; -std::ostream& -print_cli_options(std::ostream& out) { - /* - for (const auto& opt : cli_config_def.options) { - if (opt.second.cli.size() != 0) { - out << "\t" << std::left << std::setw(40) << std::string("--") + opt.second.cli; - out << "\t" << opt.second.tooltip << "\n"; - if (opt.second.default_value != nullptr) - out << "\t" << std::setw(40) << " " << "\t" << " (default: " << opt.second.default_value->serialize() << ")"; - out << "\n"; - } - } - std::cerr << std::endl; - */ - return out; -} - -std::ostream& -print_print_options(std::ostream& out) { - for (const auto& opt : print_config_def.options) { - if (opt.second.cli.size() != 0) { - out << "\t" << std::left << std::setw(40) << std::string("--") + opt.second.cli; - out << "\t" << opt.second.tooltip << "\n"; - if (opt.second.default_value != nullptr) - out << "\t" << std::setw(40) << " " << "\t" << " (default: " << opt.second.default_value->serialize() << ")"; - out << "\n"; - } - } - std::cerr << std::endl; - return out; -} - } diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 0a56d8714..ad9839750 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -661,11 +661,6 @@ extern const CLIActionsConfigDef cli_actions_config_def; extern const CLITransformConfigDef cli_transform_config_def; extern const CLIMiscConfigDef cli_misc_config_def; -/// Iterate through all of the print options and write them to a stream. -std::ostream& print_print_options(std::ostream& out); -/// Iterate through all of the CLI options and write them to a stream. -std::ostream& print_cli_options(std::ostream& out); - } #endif