From 8eb8d0b1db58678698cad4a5109a48baba8dd2ca Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Wed, 19 Nov 2025 21:27:12 +0100 Subject: [PATCH] set cache location from cli args --- cmd/steamimmich.go | 2 ++ internal/steamimmich.go | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/steamimmich.go b/cmd/steamimmich.go index 32fba9a..3c30265 100644 --- a/cmd/steamimmich.go +++ b/cmd/steamimmich.go @@ -16,6 +16,7 @@ type args struct { UserdataDir string `arg:"--steam-userdata-dir" placeholder:"USERDATA_DIR" help:"Steam userdata directory. If not set, search automaticly."` DeviceID string `arg:"--device-id" default:"steam-immich" help:"Device ID of the uploads"` Album string `arg:"--album" help:"UUID of a album to upload to"` + CacheFile string `arg:"--cache" default:"$XDG_CACHE_HOME/steam-immich.json" help:"Location of the cache file"` } func Run() { @@ -43,6 +44,7 @@ func Run() { UserdataDir: steamUserdataDir, DeiveID: args.DeviceID, Album: args.Album, + CacheFile: os.ExpandEnv(args.CacheFile), }) } diff --git a/internal/steamimmich.go b/internal/steamimmich.go index f8ea2d6..284ada0 100644 --- a/internal/steamimmich.go +++ b/internal/steamimmich.go @@ -12,6 +12,7 @@ type Config struct { UserdataDir string DeiveID string Album string + CacheFile string } func Run(config Config) { @@ -29,7 +30,7 @@ func Run(config Config) { immichClient := newImmichHttpClient(config.APIKey) - localState, err := loadLocalState("./state.json") + localState, err := loadLocalState(config.CacheFile) if err != nil { log.Fatalf("Failed to load local state: %s", err) } @@ -81,7 +82,7 @@ func Run(config Config) { } log.Println("Finished uploading screenshots") - err = saveLocalState("./state.json", *localState) + err = saveLocalState(config.CacheFile, *localState) if err != nil { log.Fatalf("Failed to save local cache: %s", err) return