From 8383a241fc3cf5b022c9c53f8f19690edf04177b Mon Sep 17 00:00:00 2001 From: s Date: Mon, 10 Nov 2025 15:22:32 -0500 Subject: refactor: restructure client modules and add config file support - Split large osint.go client into focused modules (bssid.go, breachforum.go, buckets.go, etc.) - Add config file support with init command for API key management - Remove api-key flag in favor of config file + env var fallback - Update API paths to remove /osint prefix - Add crawl endpoint streaming support - Improve error handling with 402 payment required status --- cmd/reddit.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'cmd/reddit.go') diff --git a/cmd/reddit.go b/cmd/reddit.go index 1096a23..194fdab 100644 --- a/cmd/reddit.go +++ b/cmd/reddit.go @@ -82,8 +82,7 @@ func init() { } func runRedditSubredditPosts(cmd *cobra.Command, args []string) error { - apiKey, _ := cmd.Flags().GetString("api-key") - cfg := config.New().WithAPIKey(apiKey) + cfg := config.New() c, err := client.New(cfg) if err != nil { @@ -107,8 +106,7 @@ func runRedditSubredditPosts(cmd *cobra.Command, args []string) error { } func runRedditSubredditComments(cmd *cobra.Command, args []string) error { - apiKey, _ := cmd.Flags().GetString("api-key") - cfg := config.New().WithAPIKey(apiKey) + cfg := config.New() c, err := client.New(cfg) if err != nil { @@ -132,8 +130,7 @@ func runRedditSubredditComments(cmd *cobra.Command, args []string) error { } func runRedditUserPosts(cmd *cobra.Command, args []string) error { - apiKey, _ := cmd.Flags().GetString("api-key") - cfg := config.New().WithAPIKey(apiKey) + cfg := config.New() c, err := client.New(cfg) if err != nil { @@ -157,8 +154,7 @@ func runRedditUserPosts(cmd *cobra.Command, args []string) error { } func runRedditUserComments(cmd *cobra.Command, args []string) error { - apiKey, _ := cmd.Flags().GetString("api-key") - cfg := config.New().WithAPIKey(apiKey) + cfg := config.New() c, err := client.New(cfg) if err != nil { @@ -182,8 +178,7 @@ func runRedditUserComments(cmd *cobra.Command, args []string) error { } func runRedditUserAbout(cmd *cobra.Command, args []string) error { - apiKey, _ := cmd.Flags().GetString("api-key") - cfg := config.New().WithAPIKey(apiKey) + cfg := config.New() c, err := client.New(cfg) if err != nil { -- cgit v1.2.3