diff --git a/internal/backends/spotifyhistory/spotifyhistory.go b/internal/backends/spotifyhistory/spotifyhistory.go index 90ee8ff..5f67604 100644 --- a/internal/backends/spotifyhistory/spotifyhistory.go +++ b/internal/backends/spotifyhistory/spotifyhistory.go @@ -38,10 +38,11 @@ func (b *SpotifyHistoryBackend) Name() string { return "spotify-history" } func (b *SpotifyHistoryBackend) Options() []models.BackendOption { return []models.BackendOption{{ - Name: "archive-path", - Label: i18n.Tr("Archive path"), - Type: models.String, - Default: "./my_spotify_data_extended.zip", + Name: "archive-path", + Label: i18n.Tr("Archive path"), + Type: models.String, + Default: "./my_spotify_data_extended.zip", + MigrateFrom: "dir-path", }, { Name: "ignore-incognito", Label: i18n.Tr("Ignore listens in incognito mode"), diff --git a/internal/cli/services.go b/internal/cli/services.go index df27833..65e4337 100644 --- a/internal/cli/services.go +++ b/internal/cli/services.go @@ -83,6 +83,12 @@ func PromptExtraOptions(config config.ServiceConfig) (config.ServiceConfig, erro current, exists := config.ConfigValues[opt.Name] if exists { opt.Default = fmt.Sprintf("%v", current) + } else if opt.MigrateFrom != "" { + // If there is an old value to migrate from, try that + fallback, exists := config.ConfigValues[opt.MigrateFrom] + if exists { + opt.Default = fmt.Sprintf("%v", fallback) + } } val, err := Prompt(opt) diff --git a/internal/models/options.go b/internal/models/options.go index ffa3ae6..0e09dd7 100644 --- a/internal/models/options.go +++ b/internal/models/options.go @@ -25,9 +25,10 @@ const ( ) type BackendOption struct { - Name string - Label string - Type OptionType - Default string - Validate func(string) error + Name string + Label string + Type OptionType + Default string + Validate func(string) error + MigrateFrom string }