mirror of
https://github.com/sbrow/envr.git
synced 2026-08-26 09:53:32 -04:00
refactor: Removed needless guards from write_flags_table.
This commit is contained in:
@@ -18,9 +18,7 @@
|
|||||||
|
|
||||||
9. Consider getting rid of color global.
|
9. Consider getting rid of color global.
|
||||||
|
|
||||||
10. `write_flags_table` should never return false.
|
10. Audit ssh.odin for places where `#no_bounds_check` would be appropriate.
|
||||||
|
|
||||||
11. Audit ssh.odin for places where `#no_bounds_check` would be appropriate.
|
|
||||||
|
|
||||||
## Double-check AI output
|
## Double-check AI output
|
||||||
|
|
||||||
|
|||||||
@@ -206,10 +206,9 @@ write_command_help :: proc(name: string, w: io.Writer) -> bool {
|
|||||||
tbl: table.Table
|
tbl: table.Table
|
||||||
table.init(&tbl, context.temp_allocator, context.temp_allocator)
|
table.init(&tbl, context.temp_allocator, context.temp_allocator)
|
||||||
table.padding(&tbl, 2, 0)
|
table.padding(&tbl, 2, 0)
|
||||||
if write_flags_table(&tbl, info.flags) {
|
write_flags_table(&tbl, info.flags)
|
||||||
fmt.wprintf(w, "\n", flush = false)
|
fmt.wprintf(w, "\n", flush = false)
|
||||||
write_borderless_table(w, &tbl)
|
write_borderless_table(w, &tbl)
|
||||||
}
|
|
||||||
table_reset(&tbl)
|
table_reset(&tbl)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -267,8 +266,7 @@ flag_field_info :: proc(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
write_flags_table :: proc(tbl: ^table.Table, flags: bit_set[Flag_Type]) -> (has_rows: bool) {
|
write_flags_table :: proc(tbl: ^table.Table, flags: bit_set[Flag_Type]) {
|
||||||
if flags == {} do return false
|
|
||||||
table.caption(tbl, "Flags:")
|
table.caption(tbl, "Flags:")
|
||||||
for ft in Flag_Type {
|
for ft in Flag_Type {
|
||||||
if ft not_in flags do continue
|
if ft not_in flags do continue
|
||||||
@@ -285,7 +283,6 @@ write_flags_table :: proc(tbl: ^table.Table, flags: bit_set[Flag_Type]) -> (has_
|
|||||||
table.row(tbl, colorize(.Flag, names, tbl.format_allocator), desc)
|
table.row(tbl, colorize(.Flag, names, tbl.format_allocator), desc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
find_command :: proc(name: string) -> (CommandInfo, bool) {
|
find_command :: proc(name: string) -> (CommandInfo, bool) {
|
||||||
@@ -365,9 +362,8 @@ at before, restore your backup with:
|
|||||||
write_borderless_table(w, &tbl)
|
write_borderless_table(w, &tbl)
|
||||||
table_reset(&tbl)
|
table_reset(&tbl)
|
||||||
|
|
||||||
if write_flags_table(&tbl, GLOBAL_FLAGS) {
|
write_flags_table(&tbl, GLOBAL_FLAGS)
|
||||||
write_borderless_table(w, &tbl)
|
write_borderless_table(w, &tbl)
|
||||||
}
|
|
||||||
table_reset(&tbl)
|
table_reset(&tbl)
|
||||||
|
|
||||||
fmt.wprintf(
|
fmt.wprintf(
|
||||||
|
|||||||
Reference in New Issue
Block a user