From 9b14c12e0ccd5c96dd9f17d1b20fe134308d2184 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 8 Nov 2024 22:52:31 +0200 Subject: refactor --- cmd/gos/main.go | 5 ++--- internal/config/args.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/gos/main.go b/cmd/gos/main.go index 774dd13..ee7aae7 100644 --- a/cmd/gos/main.go +++ b/cmd/gos/main.go @@ -19,11 +19,10 @@ func main() { dry := flag.Bool("dry", false, "Dry run") version := flag.Bool("version", false, "Display version") gosDir := flag.String("gosDir", filepath.Join(os.Getenv("HOME"), ".gosdir"), "Gos' queue and DB directory") + cacheDir := flag.String("cacheDir", filepath.Join(*gosDir, "cache"), "Go's cache dir") browser := flag.String("browser", "firefox", "OAuth2 browser") secretsConfigPath := filepath.Join(os.Getenv("HOME"), ".config/gos/gosec.json") secretsConfigPath = *flag.String("secretsConfig", secretsConfigPath, "Gos' secret config") - cacheDir := filepath.Join(os.Getenv("HOME"), ".config/gos/cache") - cacheDir = *flag.String("cacheDir", cacheDir, "Go's cache dir") platforms := flag.String("platforms", "Mastodon:500,LinkedIn:1000", "Platforms enabled plus their post size limits") target := flag.Int("target", 2, "How many posts per week are the target?") minQueued := flag.Int("minQueued", 4, "Minimum of queued items until printing a warn message!") @@ -47,7 +46,7 @@ func main() { PauseDays: *pauseDays, Lookback: time.Duration(*lookback) * time.Hour * 24, SecretsConfigPath: secretsConfigPath, - CacheDir: cacheDir, + CacheDir: *cacheDir, Secrets: secrets, OAuth2Browser: *browser, } diff --git a/internal/config/args.go b/internal/config/args.go index 77c3850..8c9f767 100644 --- a/internal/config/args.go +++ b/internal/config/args.go @@ -13,6 +13,7 @@ var validPlatforms = []string{"mastodon", "linkedin"} type Args struct { GosDir string + CacheDir string DryRun bool Platforms map[string]int // Platform name and post size limits Target int @@ -20,7 +21,6 @@ type Args struct { MaxDaysQueued int PauseDays int Lookback time.Duration - CacheDir string SecretsConfigPath string Secrets Secrets OAuth2Browser string -- cgit v1.2.3