# # # patch "automate.cc" # from [fa24428de48ae21e3a4cd877ac6af11055383399] # to [22f921bd6fda4b7783bcf52af28ce15c8ff2b2d5] # # patch "cmd_automate.cc" # from [f507718f94531c96f86f38ec3582d7892b802136] # to [509e178776ec2e15eebda4476afef9ff0b77b367] # # patch "ui.hh" # from [2623987665f579dc693dd37483c6a57a6b1bfc93] # to [2e63f2165702aa2904d7169b5ae68a28a0eb5b3d] # ============================================================ --- automate.cc fa24428de48ae21e3a4cd877ac6af11055383399 +++ automate.cc 22f921bd6fda4b7783bcf52af28ce15c8ff2b2d5 @@ -2026,6 +2026,13 @@ CMD_AUTOMATE(drop_db_variables, N_("DOMA } } +CMD_AUTOMATE(test, "", N_("Test"), "",options::opts::none) +{ + P(F("normal printing")); + W(F("a warning")); + E(false, F("a user error")); +} + // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- cmd_automate.cc f507718f94531c96f86f38ec3582d7892b802136 +++ cmd_automate.cc 509e178776ec2e15eebda4476afef9ff0b77b367 @@ -329,6 +329,20 @@ struct automate_ostream : public std::os { _M_autobuf.end_cmd(); } }; + +struct user_interface_stdio : public user_interface +{ +public: + user_interface_stdio(automate_ostream * ostr) + : user_interface(), ostream(ostr) + { initialize(); } + ~user_interface_stdio() {} + void inform(std::string const & line) + { *ostream << "[" << line << "]"; } +private: + automate_ostream * ostream; +}; + CMD_AUTOMATE(stdio, "", N_("Automates several commands in one run"), "", @@ -343,6 +357,10 @@ CMD_AUTOMATE(stdio, "", automate_ostream os(output, app.opts.automate_stdio_size); automate_reader ar(std::cin); + + user_interface old_ui = ui; + ui = user_interface_stdio(&os); + vector > params; vector cmdline; while(ar.get_command(params, cmdline))//while(!EOF) @@ -408,6 +426,8 @@ CMD_AUTOMATE(stdio, "", } os.end_cmd(); } + + ui = old_ui; } LUAEXT(mtn_automate, ) ============================================================ --- ui.hh 2623987665f579dc693dd37483c6a57a6b1bfc93 +++ ui.hh 2e63f2165702aa2904d7169b5ae68a28a0eb5b3d @@ -46,14 +46,14 @@ public: { public: user_interface(); - ~user_interface(); + virtual ~user_interface(); void initialize(); void deinitialize(); void warn(std::string const & warning); void warn(format_base const & fmt) { warn(fmt.str()); } void fatal(std::string const & fatal); void fatal(format_base const & fmt) { fatal(fmt.str()); } - void inform(std::string const & line); + virtual void inform(std::string const & line); void inform(format_base const & fmt) { inform(fmt.str()); } void fatal_exception(std::exception const & ex); void fatal_exception();