feat: Added --format, -f flag.

Allows printing data in tabular or json format.
This commit is contained in:
2026-06-25 17:34:30 -04:00
parent 6fa68d10b1
commit e74fc4f35a
7 changed files with 175 additions and 9 deletions

View File

@@ -2,8 +2,6 @@ package main
import "core:encoding/json"
import "core:fmt"
import "core:os"
import "core:terminal"
import "core:text/table"
SyncEntry :: struct {
@@ -12,7 +10,6 @@ SyncEntry :: struct {
}
// TODO: Check for quiet failures.
// TODO: Support --format -f flags
cmd_sync :: proc(cmd: ^Command) {
db, db_ok := db_open(cmd.config_path)
if !db_ok {
@@ -49,7 +46,7 @@ cmd_sync :: proc(cmd: ^Command) {
}
}
if terminal.is_terminal(os.stdout) {
if get_format(cmd) == .Table {
t: table.Table
table.init(&t, context.temp_allocator, context.temp_allocator)
table.padding(&t, 1, 1)