# # # patch "cmd.hh" # from [ca7629f05596351ce401a93d3e0c66bec34f26b2] # to [2704dcd756496bee54d047303d73fe86e4a1434d] # # patch "cmd_automate.cc" # from [6edf669ba42dba31a44c266185e39c2b8ac825cf] # to [726cea4913efdaf538cd9976357a0cb0c8f09fc1] # ============================================================ --- cmd.hh ca7629f05596351ce401a93d3e0c66bec34f26b2 +++ cmd.hh 2704dcd756496bee54d047303d73fe86e4a1434d @@ -119,6 +119,7 @@ namespace commands public: automate(std::string const & name, bool stdio_ok, + bool hidden, std::string const & params, std::string const & abstract, std::string const & desc, @@ -252,34 +253,37 @@ void commands::cmd_ ## C::exec(app_state // command definition allows the description of input/output format, // error conditions, version when added, etc. 'desc' can later be // automatically built from these. -#define _CMD_AUTOMATE2(C, stdio_ok, params, abstract, desc, opts) \ -namespace commands { \ - class automate_ ## C : public automate \ - { \ - void exec_from_automate(app_state & app, \ - command_id const & execid, \ - args_vector const & args, \ - std::ostream & output) const; \ - public: \ - automate_ ## C() : automate(#C, stdio_ok, params, \ - abstract, desc, \ - options::options_type() | opts) \ - {} \ - }; \ - automate_ ## C C ## _automate; \ -} \ -void commands::automate_ ## C :: exec_from_automate \ - (app_state & app, \ - command_id const & execid, \ - args_vector const & args, \ +#define _CMD_AUTOMATE2(C, stdio_ok, hidden, params, abstract, desc, opts) \ +namespace commands { \ + class automate_ ## C : public automate \ + { \ + void exec_from_automate(app_state & app, \ + command_id const & execid, \ + args_vector const & args, \ + std::ostream & output) const; \ + public: \ + automate_ ## C() : automate(#C, stdio_ok, hidden, params, \ + abstract, desc, \ + options::options_type() | opts) \ + {} \ + }; \ + automate_ ## C C ## _automate; \ +} \ +void commands::automate_ ## C :: exec_from_automate \ + (app_state & app, \ + command_id const & execid, \ + args_vector const & args, \ std::ostream & output) const #define CMD_AUTOMATE(C, params, abstract, desc, opts) \ - _CMD_AUTOMATE2(C, true, params, abstract, desc, opts) + _CMD_AUTOMATE2(C, true, false, params, abstract, desc, opts) #define CMD_AUTOMATE_NO_STDIO(C, params, abstract, desc, opts) \ - _CMD_AUTOMATE2(C, false, params, abstract, desc, opts) + _CMD_AUTOMATE2(C, false, false, params, abstract, desc, opts) +#define CMD_AUTOMATE_HIDDEN(C, params, abstract, desc, opts) \ + _CMD_AUTOMATE2(C, true, true, params, abstract, desc, opts) + CMD_FWD_DECL(__root__); CMD_FWD_DECL(automation); CMD_FWD_DECL(conflicts); ============================================================ --- cmd_automate.cc 6edf669ba42dba31a44c266185e39c2b8ac825cf +++ cmd_automate.cc 726cea4913efdaf538cd9976357a0cb0c8f09fc1 @@ -39,11 +39,12 @@ namespace commands { namespace commands { automate::automate(string const & name, bool stdio_ok, + bool hidden, string const & params, string const & abstract, string const & desc, options::options_type const & opts) : - command(name, "", CMD_REF(automate), false, false, params, abstract, + command(name, "", CMD_REF(automate), false, hidden, params, abstract, // We set use_workspace_options true, because all automate // commands need a database, and they expect to get the database // name from the workspace options, even if they don't need a @@ -104,6 +105,49 @@ CMD_AUTOMATE(interface_version, "", output << interface_version << '\n'; } +// Name: interface_version +// Arguments: { info | warning | error | fatal | ticker } +// Added in: FIXME +// Purpose: Emulates certain kinds of diagnostic / UI messages for debugging +// and testing purposes +// Output format: None +// Error conditions: None. +CMD_AUTOMATE_HIDDEN(bandtest, "{ info | warning | error | ticker }", + N_("Emulates certain kinds of diagnostic / UI messages " + "for debugging and testing purposes, such as stdio"), + "", + options::opts::none) +{ + E(args.size() == 1, origin::user, + F("wrong argument count")); + + std::string type = args.at(0)(); + if (type.compare("info") == 0) + P(F("this is an informational message")); + else if (type.compare("warning") == 0) + W(F("this is a warning")); + else if (type.compare("error") == 0) + E(false, origin::user, F("this is an error message")); + else if (type.compare("ticker") == 0) + { + ticker first("first ticker (not fixed)", "f", 3); + ticker second("second ticker (fixed)", "s", 5); + + int max = 20; + second.set_total(max); + + for (int i=0; i(opaque)->write_out_of_band(channel, text);