cli: fix default flags when their command equivalents are disabled (#21469)

* always replace `\r\n` with `\n`

* fix

* test

* cleanup

* add doc comment
This commit is contained in:
Turiiya 2024-05-08 13:11:40 +02:00 committed by GitHub
parent 4320f8641b
commit c0fec31bef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 69 additions and 13 deletions

View file

@ -341,8 +341,7 @@ fn (cmd Command) check_version_flag() {
if cmd.defaults.parsed.version.flag && cmd.version != '' && cmd.flags.contains('version') {
version_flag := cmd.flags.get_bool('version') or { return } // ignore error and handle command normally
if version_flag {
version_cmd := cmd.commands.get('version') or { return } // ignore error and handle command normally
version_cmd.execute(version_cmd) or { panic(err) }
print_version_for_command(cmd) or { panic(err) }
exit(0)
}
}