From b020c1db6eb2614c9f016b58656fd373b883b8bc Mon Sep 17 00:00:00 2001 From: bradlo Date: Tue, 2 May 2023 15:04:21 -0600 Subject: [PATCH] implement list-transactions command --- rai/cmds.go | 8 ++++++++ rai/main.go | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/rai/cmds.go b/rai/cmds.go index 5573300..e70aa73 100644 --- a/rai/cmds.go +++ b/rai/cmds.go @@ -613,6 +613,14 @@ func listEdbNames(cmd *cobra.Command, args []string) { action.Exit(names, nil) } +func listTransactions(cmd *cobra.Command, args []string) { + // assert len(args) == 1 + action := newAction(cmd) + action.Start("List transactions") + rsp, err := action.Client().ListTransactions() + action.Exit(rsp, err) +} + // Parse the schema option string into the schema definition map that is // expected by the golang client. // diff --git a/rai/main.go b/rai/main.go index 4307b05..9e4d79c 100644 --- a/rai/main.go +++ b/rai/main.go @@ -208,6 +208,13 @@ func addCommands(root *cobra.Command) { cmd.Flags().StringP("engine", "e", "", "default engine") root.AddCommand(cmd) + cmd = &cobra.Command{ + Use: "list-transactions", + Short: "List transaction history", + Args: cobra.ExactArgs(0), + Run: listTransactions} + root.AddCommand(cmd) + cmd = &cobra.Command{ Use: "load-csv database file", Short: "Load a CSV file into the given database",