/////////////////////////////////////////////////////////////////////////// Dispatch to the command found by the CLI parser.
| 853 | //////////////////////////////////////////////////////////////////////////////// |
| 854 | // Dispatch to the command found by the CLI parser. |
| 855 | int Context::dispatch(std::string& out) { |
| 856 | // Autocomplete args against keywords. |
| 857 | std::string command = cli2.getCommand(); |
| 858 | if (command != "") { |
| 859 | updateXtermTitle(); |
| 860 | updateVerbosity(); |
| 861 | |
| 862 | Command* c = commands[command]; |
| 863 | assert(c); |
| 864 | |
| 865 | // The command know whether they need a GC or recurrence update. |
| 866 | if (c->needs_gc()) { |
| 867 | tdb2.gc(); |
| 868 | } |
| 869 | |
| 870 | // This is something that is only needed for write commands with no other |
| 871 | // filter processing. |
| 872 | if (c->accepts_modifications() && !c->accepts_filter()) { |
| 873 | cli2.prepareFilter(); |
| 874 | } |
| 875 | |
| 876 | // With rc.debug.parser == 2, there are more tree dumps than you might want, |
| 877 | // but we need the rc.debug.parser == 1 case covered also, with the final |
| 878 | // tree. |
| 879 | if (config.getBoolean("debug") && config.getInteger("debug.parser") == 1) |
| 880 | debug(cli2.dump("Parse Tree (before command-specifіc processing)")); |
| 881 | |
| 882 | if (c->needs_recur_update() && Context::getContext().config.getBoolean("gc")) { |
| 883 | handleUntil(); |
| 884 | handleRecurrence(); |
| 885 | } |
| 886 | |
| 887 | return c->execute(out); |
| 888 | } |
| 889 | |
| 890 | assert(commands["help"]); |
| 891 | return commands["help"]->execute(out); |
| 892 | } |
| 893 | |
| 894 | //////////////////////////////////////////////////////////////////////////////// |
| 895 | int Context::getWidth() { |
nothing calls this directly
no test coverage detected