0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 05:08:59 +02:00

modules/console: Add compose copy cmd.

This commit is contained in:
Jason Volk 2018-05-30 10:05:01 -07:00
parent 60fcb54815
commit 7471417091

View file

@ -2644,6 +2644,45 @@ console_cmd__compose__final(opt &out, const string_view &line)
return true;
}
bool
console_cmd__compose__copy(opt &out, const string_view &line)
{
const params param{line, " ",
{
"srcid", "[dstid]"
}};
const auto &srcid
{
param.at<uint>(0)
};
const auto &dstid
{
param.at<uint>(1, compose.size())
};
const auto &src
{
compose.at(srcid)
};
if(compose.size() < dstid)
throw error
{
"Cannot compose position %d without composing %d first", dstid, compose.size()
};
if(compose.size() == dstid)
{
compose.emplace_back(src);
return true;
}
compose.at(dstid) = src;
return true;
}
bool
console_cmd__compose__clear(opt &out, const string_view &line)
{