From f8c822bab53ba907d30881a989f576a2f2a85b50 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Wed, 26 Oct 2022 00:30:00 -0700 Subject: [PATCH] Add command to create a custom column --- hishtory.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hishtory.go b/hishtory.go index 362a978..14179e1 100644 --- a/hishtory.go +++ b/hishtory.go @@ -143,6 +143,17 @@ func main() { default: log.Fatalf("Unrecognized config key: %s", key) } + case "add-custom-column": + // TODO: implement a way of deleting a custom column + columnName := os.Args[2] + command := os.Args[3] + ctx := hctx.MakeContext() + config := hctx.GetConf(ctx) + if config.CustomColumns == nil { + config.CustomColumns = make([]hctx.CustomColumnDefinition, 0) + } + config.CustomColumns = append(config.CustomColumns, hctx.CustomColumnDefinition{ColumnName: columnName, ColumnCommand: command}) + lib.CheckFatalError(hctx.SetConfig(config)) case "reupload": // Purposefully undocumented since this command is generally not necessary to run lib.CheckFatalError(lib.Reupload(hctx.MakeContext()))