From 7d6eb2f1a38e2265751cd61a43769959405866b4 Mon Sep 17 00:00:00 2001 From: s Date: Wed, 26 Nov 2025 09:06:15 -0500 Subject: feat: add debug flag to enable raw api response output --- cmd/helpers.go | 4 ++-- cmd/root.go | 8 +++++++- cmd/sl.go | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/cmd/helpers.go b/cmd/helpers.go index f53f235..133fb0a 100644 --- a/cmd/helpers.go +++ b/cmd/helpers.go @@ -8,11 +8,11 @@ import ( ) func newClient() (*client.Client, error) { - return client.New(config.New()) + return client.New(config.New().WithDebug(debugOutput)) } func newUnauthenticatedClient() (*client.Client, error) { - return client.NewUnauthenticated(config.New()) + return client.NewUnauthenticated(config.New().WithDebug(debugOutput)) } func checkError(errorMsg string) error { diff --git a/cmd/root.go b/cmd/root.go index c4239ba..292e96d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -9,7 +9,8 @@ import ( ) var ( - jsonOutput bool + jsonOutput bool + debugOutput bool ) var rootCmd = &cobra.Command{ @@ -33,8 +34,13 @@ func Execute() { func init() { rootCmd.PersistentFlags().BoolVarP(&jsonOutput, "json", "j", false, "Output raw JSON instead of formatted text") + rootCmd.PersistentFlags().BoolVarP(&debugOutput, "debug", "d", false, "Enable debug output (shows raw API responses)") } func IsJSONOutput() bool { return jsonOutput } + +func IsDebugOutput() bool { + return debugOutput +} diff --git a/cmd/sl.go b/cmd/sl.go index 8c43506..1c8de09 100644 --- a/cmd/sl.go +++ b/cmd/sl.go @@ -23,7 +23,7 @@ func init() { slCmd.Flags().StringP("ingest_start_date", "i", "", "Ingest timestamp start date") slCmd.Flags().StringP("ingest_end_date", "e", "", "Ingest timestamp end date") slCmd.Flags().StringP("posted_start_date", "p", "", "Date posted start date") - slCmd.Flags().StringP("posted_end_date", "d", "", "Date posted end date") + slCmd.Flags().StringP("posted_end_date", "D", "", "Date posted end date") slCmd.Flags().StringP("format", "f", "json", "Response format") } -- cgit v1.2.3