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:
parent
7279e49077
commit
5d269ba703
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user