From 6f002f0b214508fae23a32b552e9673cee8e27b2 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 26 Jan 2023 18:30:21 -0800 Subject: [PATCH] modules/console: Add rep prefix cmd. --- modules/console.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index f55869b3f..bc88c5454 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -369,6 +369,33 @@ console_cmd__time(opt &out, const string_view &line) return ret; } +// Rep + +bool +console_cmd__rep(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "count", + }}; + + const auto count + { + param.at("count") + }; + + const auto cmd + { + tokens_after(line, ' ', 0) + }; + + for(uint i(0); i < count; ++i) + if(!_console_command(out, cmd)) + return false; + + return true; +} + // Help bool