Add set-face/unset-face CommandHelpers
This commit is contained in:
parent
4cd7583bbc
commit
22166a69c2
|
@ -2091,6 +2091,21 @@ static Completions complete_face(const Context& context, CompletionFlags flags,
|
||||||
transform([](auto& entry) -> const String& { return entry.key; }))};
|
transform([](auto& entry) -> const String& { return entry.key; }))};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String face_doc_helper(const Context& context, CommandParameters params)
|
||||||
|
{
|
||||||
|
if (params.size() < 2)
|
||||||
|
return {};
|
||||||
|
try
|
||||||
|
{
|
||||||
|
auto face = context.faces()[params[1]];
|
||||||
|
return format("{}:\n{}", params[1], indent(to_string(face)));
|
||||||
|
}
|
||||||
|
catch (runtime_error&)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const CommandDesc set_face_cmd = {
|
const CommandDesc set_face_cmd = {
|
||||||
"set-face",
|
"set-face",
|
||||||
"face",
|
"face",
|
||||||
|
@ -2104,7 +2119,7 @@ const CommandDesc set_face_cmd = {
|
||||||
"facespec can as well just be the name of another face",
|
"facespec can as well just be the name of another face",
|
||||||
ParameterDesc{{}, ParameterDesc::Flags::None, 3, 3},
|
ParameterDesc{{}, ParameterDesc::Flags::None, 3, 3},
|
||||||
CommandFlags::None,
|
CommandFlags::None,
|
||||||
CommandHelper{},
|
face_doc_helper,
|
||||||
make_completer(complete_scope, complete_face, complete_face),
|
make_completer(complete_scope, complete_face, complete_face),
|
||||||
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
||||||
{
|
{
|
||||||
|
@ -2121,7 +2136,7 @@ const CommandDesc unset_face_cmd = {
|
||||||
"unset-face <scope> <name>: remove <face> from <scope>",
|
"unset-face <scope> <name>: remove <face> from <scope>",
|
||||||
ParameterDesc{{}, ParameterDesc::Flags::None, 2, 2},
|
ParameterDesc{{}, ParameterDesc::Flags::None, 2, 2},
|
||||||
CommandFlags::None,
|
CommandFlags::None,
|
||||||
CommandHelper{},
|
face_doc_helper,
|
||||||
make_completer(complete_scope, complete_face),
|
make_completer(complete_scope, complete_face),
|
||||||
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user