flag, examples: add compact to flag.DocOptions (#21888)

This commit is contained in:
larpon 2024-07-18 08:19:58 +02:00 committed by GitHub
parent 6d3a2acf23
commit 3bc6d30b69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 9 deletions

View file

@ -36,6 +36,8 @@ enum Edit {
description_padding
description_width
flag_indent
// DocOptions.compact
compact
// DocOptions.show flags
name
version
@ -56,6 +58,9 @@ pub fn (e Edit) next() Edit {
.flag_indent
}
.flag_indent {
.compact
}
.compact {
.name
}
.name {
@ -124,6 +129,9 @@ fn event(e &tui.Event, mut app App) {
.description_width {
app.layout.description_width += incr_decr
}
.compact {
app.options.compact = !app.options.compact
}
.name {
app.options.show.toggle(.name)
}
@ -165,6 +173,9 @@ fn frame(mut app App) {
.description_width {
'${app.layout.description_width}'
}
.compact {
if app.options.compact { 'on' } else { 'off' }
}
.name {
if app.options.show.has(.name) { 'on' } else { 'off' }
}