mirror of
https://github.com/sbrow/envr.git
synced 2026-08-26 18:03:32 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ffc38171c | |||
| 8b9a9789ab | |||
| 6244a6c8ce |
@@ -16,9 +16,7 @@
|
||||
|
||||
8. Add tests for untested commands.
|
||||
|
||||
9. Consider getting rid of color global.
|
||||
|
||||
10. `write_flags_table` should never return false.
|
||||
9. Audit ssh.odin for places where `#no_bounds_check` would be appropriate.
|
||||
|
||||
## Double-check AI output
|
||||
|
||||
|
||||
@@ -206,10 +206,9 @@ write_command_help :: proc(name: string, w: io.Writer) -> bool {
|
||||
tbl: table.Table
|
||||
table.init(&tbl, context.temp_allocator, context.temp_allocator)
|
||||
table.padding(&tbl, 2, 0)
|
||||
if write_flags_table(&tbl, info.flags) {
|
||||
fmt.wprintf(w, "\n", flush = false)
|
||||
write_borderless_table(w, &tbl)
|
||||
}
|
||||
write_flags_table(&tbl, info.flags)
|
||||
fmt.wprintf(w, "\n", flush = false)
|
||||
write_borderless_table(w, &tbl)
|
||||
table_reset(&tbl)
|
||||
return true
|
||||
}
|
||||
@@ -267,8 +266,7 @@ flag_field_info :: proc(
|
||||
return
|
||||
}
|
||||
|
||||
write_flags_table :: proc(tbl: ^table.Table, flags: bit_set[Flag_Type]) -> (has_rows: bool) {
|
||||
if flags == {} do return false
|
||||
write_flags_table :: proc(tbl: ^table.Table, flags: bit_set[Flag_Type]) {
|
||||
table.caption(tbl, "Flags:")
|
||||
for ft in Flag_Type {
|
||||
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)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
find_command :: proc(name: string) -> (CommandInfo, bool) {
|
||||
@@ -365,9 +362,8 @@ at before, restore your backup with:
|
||||
write_borderless_table(w, &tbl)
|
||||
table_reset(&tbl)
|
||||
|
||||
if write_flags_table(&tbl, GLOBAL_FLAGS) {
|
||||
write_borderless_table(w, &tbl)
|
||||
}
|
||||
write_flags_table(&tbl, GLOBAL_FLAGS)
|
||||
write_borderless_table(w, &tbl)
|
||||
table_reset(&tbl)
|
||||
|
||||
fmt.wprintf(
|
||||
|
||||
@@ -35,13 +35,13 @@ parse_ssh_public_key :: proc(pub_path: string) -> (pub: [32]u8, ok: bool) {
|
||||
return
|
||||
}
|
||||
|
||||
buf := decoded
|
||||
key_type, type_ok := read_wire_string(&buf)
|
||||
rest := decoded
|
||||
key_type, type_ok := read_wire_string(&rest)
|
||||
if !type_ok || string(key_type) != SSH_ED25519 {
|
||||
return
|
||||
}
|
||||
|
||||
pk_data, pk_ok := read_wire_string(&buf)
|
||||
pk_data, pk_ok := read_wire_string(&rest)
|
||||
if !pk_ok || len(pk_data) != 32 {
|
||||
return
|
||||
}
|
||||
@@ -91,34 +91,34 @@ parse_ssh_private_key :: proc(priv_path: string) -> (kp: Ed25519Keypair, ok: boo
|
||||
return
|
||||
}
|
||||
|
||||
buf := decoded[len(magic):]
|
||||
rest := decoded[len(magic):]
|
||||
|
||||
ciphername, cipher_ok := read_wire_string(&buf)
|
||||
ciphername, cipher_ok := read_wire_string(&rest)
|
||||
if !cipher_ok || string(ciphername) != "none" {
|
||||
return
|
||||
}
|
||||
|
||||
kdfname, kdf_ok := read_wire_string(&buf)
|
||||
kdfname, kdf_ok := read_wire_string(&rest)
|
||||
if !kdf_ok || string(kdfname) != "none" {
|
||||
return
|
||||
}
|
||||
|
||||
_, opts_ok := read_wire_string(&buf)
|
||||
_, opts_ok := read_wire_string(&rest)
|
||||
if !opts_ok {
|
||||
return
|
||||
}
|
||||
|
||||
num_keys, nkeys_ok := read_wire_u32(&buf)
|
||||
num_keys, nkeys_ok := read_wire_u32(&rest)
|
||||
if !nkeys_ok || num_keys != 1 {
|
||||
return
|
||||
}
|
||||
|
||||
_, pub_blob_ok := read_wire_string(&buf)
|
||||
_, pub_blob_ok := read_wire_string(&rest)
|
||||
if !pub_blob_ok {
|
||||
return
|
||||
}
|
||||
|
||||
priv_blob, priv_blob_ok := read_wire_string(&buf)
|
||||
priv_blob, priv_blob_ok := read_wire_string(&rest)
|
||||
if !priv_blob_ok {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user