From 035caf059dd4c7a3a3374c7403207afe4c36d314 Mon Sep 17 00:00:00 2001 From: Naomi Kramer Date: Wed, 3 Jun 2026 10:43:22 -0400 Subject: [PATCH 1/2] Skip upgrade check on view command when exporting --- cmd/view.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/view.go b/cmd/view.go index 9d2f8f2..44defc1 100644 --- a/cmd/view.go +++ b/cmd/view.go @@ -91,9 +91,11 @@ var ViewCommand = &cli.Command{ return err } - // check for updates after running the command - if err := CheckForUpdate(cfg); err != nil { - return err + // check for updates after running the command, skip if using output flag + if !cCtx.Bool("stdout") { + if err := CheckForUpdate(cfg); err != nil { + return err + } } return nil From 17b9f35d87a4159cb9ae2bdee8e82eca0ef7d8f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Floryan?= <81591050+pawelfloryan@users.noreply.github.com> Date: Wed, 17 Jun 2026 00:04:45 +0200 Subject: [PATCH 2/2] Disabled the message when not passing output to a tty --- cmd/view.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/view.go b/cmd/view.go index 44defc1..6c620b0 100644 --- a/cmd/view.go +++ b/cmd/view.go @@ -5,6 +5,7 @@ import ( "database/sql" "errors" "fmt" + "os" "github.com/activecm/rita/v5/config" "github.com/activecm/rita/v5/database" @@ -103,8 +104,6 @@ var ViewCommand = &cli.Command{ } func runViewCmd(cfg *config.Config, dbName string, stdout bool, search string, limit int) error { - fmt.Printf("Viewing database: %s\n", dbName) - // connect to database db, err := database.ConnectToDB(context.Background(), dbName, cfg, nil) if err != nil { @@ -122,6 +121,14 @@ func runViewCmd(cfg *config.Config, dbName string, stdout bool, search string, l // if stdout was requested, get CSV output if stdout { + outInfo, err := os.Stdout.Stat() + if err != nil { + return err + } + // display the message only when printing stdout to the terminal + if (outInfo.Mode() & os.ModeCharDevice) == os.ModeCharDevice { + fmt.Printf("Viewing database: %s\n", dbName) + } // get CSV output csvData, err := viewer.GetCSVOutput(db, minTimestamp, util.GetRelativeFirstSeenTimestamp(useCurrentTime, maxTimestamp), search, limit)