12 std::vector<TclObject> outArgs;
13 outArgs.reserve(inArgs.
size());
15 while (!inArgs.
empty()) {
16 auto arg = inArgs.
front();
17 auto argStr = arg.getString();
19 if (argStr.starts_with(
'-')) {
21 append(outArgs, inArgs);
25 if (it ==
table.end()) {
27 "Invalid option: '", argStr,
"'. Must be one of ",
29 return strCat(
'\'', info.name,
'\'');
32 auto consumed = it->func(interp, inArgs);
33 inArgs = inArgs.
subspan(consumed);
35 outArgs.push_back(arg);
constexpr subspan_return_t< Offset, Count > subspan() const
constexpr reference front() const
constexpr index_type size() const noexcept
constexpr bool empty() const noexcept
detail::Joiner< Collection, Separator > join(Collection &&col, Separator &&sep)
This file implemented 3 utility functions:
std::vector< TclObject > parseTclArgs(Interpreter &interp, span< const TclObject > inArgs, span< const ArgsInfo > table)
auto find(InputRange &&range, const T &value)
constexpr auto transform(Range &&range, UnaryOp op)
std::string strCat(Ts &&...ts)