Add a fail
command to explicitely raise an error
This commit is contained in:
parent
431e226fc8
commit
145cf843dd
|
@ -725,6 +725,7 @@ command `q!` has to be used).
|
|||
`:%sh{ echo echo tchou }` will echo tchou in Kakoune, whereas
|
||||
`:nop %sh{ echo echo tchou }` will not, but both will execute the
|
||||
shell command.
|
||||
* `fail <text>`: raise an error, uses <text> as its description
|
||||
|
||||
Multiple commands
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -96,6 +96,9 @@ command *q!* has to be used). Aliases are mentionned below each commands.
|
|||
*nop*::
|
||||
does nothing, but arguments will be evaluated (e.g. shell expansion)
|
||||
|
||||
*fail* <text>::
|
||||
raise an error, uses <text> as its description
|
||||
|
||||
*declare-option* [-hidden] <type> <name> [<value>]::
|
||||
*alias* decl +
|
||||
declare a new option, the -hidden hides the option in completion
|
||||
|
|
|
@ -2105,6 +2105,20 @@ const CommandDesc rename_session_cmd = {
|
|||
}
|
||||
};
|
||||
|
||||
const CommandDesc fail_cmd = {
|
||||
"fail",
|
||||
nullptr,
|
||||
"fail [<message>]: raise an error with the given message",
|
||||
ParameterDesc{},
|
||||
CommandFlags::None,
|
||||
CommandHelper{},
|
||||
CommandCompleter{},
|
||||
[](const ParametersParser& parser, Context&, const ShellContext&)
|
||||
{
|
||||
throw runtime_error(fix_atom_text(join(parser, ' ', false)));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void register_commands()
|
||||
|
@ -2166,6 +2180,7 @@ void register_commands()
|
|||
register_command(select_cmd);
|
||||
register_command(change_directory_cmd);
|
||||
register_command(rename_session_cmd);
|
||||
register_command(fail_cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user