1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cli: fix custom help without execute handler (#18732)

This commit is contained in:
Felipe Pena 2023-07-04 00:48:53 -03:00 committed by GitHub
parent 7279e49077
commit 5d269ba703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -294,11 +294,13 @@ fn (cmd Command) check_required_flags() {
pub fn (cmd Command) execute_help() {
if cmd.commands.contains('help') {
help_cmd := cmd.commands.get('help') or { return } // ignore error and handle command normally
if !isnil(help_cmd.execute) {
help_cmd.execute(help_cmd) or { panic(err) }
} else {
print(cmd.help_message())
return
}
}
print(cmd.help_message())
}
// execute_help executes the callback registered
// for the `-man` flag option.