mirror of https://github.com/vitalif/openscad
commit
52f5fe2e92
|
@ -800,6 +800,7 @@ int main(int argc, char **argv)
|
||||||
("projection", po::value<string>(), "(o)rtho or (p)erspective when exporting png")
|
("projection", po::value<string>(), "(o)rtho or (p)erspective when exporting png")
|
||||||
("colorscheme", po::value<string>(), "colorscheme")
|
("colorscheme", po::value<string>(), "colorscheme")
|
||||||
("debug", po::value<string>(), "special debug info")
|
("debug", po::value<string>(), "special debug info")
|
||||||
|
("quiet,q", "quiet mode (don't print anything *except* errors)")
|
||||||
("o,o", po::value<string>(), "out-file")
|
("o,o", po::value<string>(), "out-file")
|
||||||
("s,s", po::value<string>(), "stl-file")
|
("s,s", po::value<string>(), "stl-file")
|
||||||
("x,x", po::value<string>(), "dxf-file")
|
("x,x", po::value<string>(), "dxf-file")
|
||||||
|
@ -835,6 +836,9 @@ int main(int argc, char **argv)
|
||||||
OpenSCAD::debug = vm["debug"].as<string>();
|
OpenSCAD::debug = vm["debug"].as<string>();
|
||||||
PRINTB("Debug on. --debug=%s",OpenSCAD::debug);
|
PRINTB("Debug on. --debug=%s",OpenSCAD::debug);
|
||||||
}
|
}
|
||||||
|
if (vm.count("quiet")) {
|
||||||
|
OpenSCAD::quiet = true;
|
||||||
|
}
|
||||||
if (vm.count("help")) help(argv[0]);
|
if (vm.count("help")) help(argv[0]);
|
||||||
if (vm.count("version")) version();
|
if (vm.count("version")) version();
|
||||||
if (vm.count("info")) arg_info = true;
|
if (vm.count("info")) arg_info = true;
|
||||||
|
|
|
@ -12,6 +12,7 @@ std::list<std::string> print_messages_stack;
|
||||||
OutputHandlerFunc *outputhandler = NULL;
|
OutputHandlerFunc *outputhandler = NULL;
|
||||||
void *outputhandler_data = NULL;
|
void *outputhandler_data = NULL;
|
||||||
std::string OpenSCAD::debug("");
|
std::string OpenSCAD::debug("");
|
||||||
|
bool OpenSCAD::quiet = false;
|
||||||
|
|
||||||
boost::circular_buffer<std::string> lastmessages(5);
|
boost::circular_buffer<std::string> lastmessages(5);
|
||||||
|
|
||||||
|
@ -63,10 +64,12 @@ void PRINT_NOCACHE(const std::string &msg)
|
||||||
else lastmessages.push_back(msg);
|
else lastmessages.push_back(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!outputhandler) {
|
if (!OpenSCAD::quiet || boost::starts_with(msg, "ERROR")) {
|
||||||
fprintf(stderr, "%s\n", msg.c_str());
|
if (!outputhandler) {
|
||||||
} else {
|
fprintf(stderr, "%s\n", msg.c_str());
|
||||||
outputhandler(msg, outputhandler_data);
|
} else {
|
||||||
|
outputhandler(msg, outputhandler_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,10 @@ inline char * _( const char * msgid ) { return gettext( msgid ); }
|
||||||
typedef void (OutputHandlerFunc)(const std::string &msg, void *userdata);
|
typedef void (OutputHandlerFunc)(const std::string &msg, void *userdata);
|
||||||
extern OutputHandlerFunc *outputhandler;
|
extern OutputHandlerFunc *outputhandler;
|
||||||
extern void *outputhandler_data;
|
extern void *outputhandler_data;
|
||||||
namespace OpenSCAD { extern std::string debug; }
|
namespace OpenSCAD {
|
||||||
|
extern std::string debug;
|
||||||
|
extern bool quiet;
|
||||||
|
}
|
||||||
|
|
||||||
void set_output_handler(OutputHandlerFunc *newhandler, void *userdata);
|
void set_output_handler(OutputHandlerFunc *newhandler, void *userdata);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue