|
@@ -30,6 +30,11 @@ var (
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
func main() {
|
|
|
|
|
+ // Load .env (godotenv) so values like CHEAPO_CLI_OUTPUT_DATE_FORMAT and
|
|
|
|
|
+ // CHEAPO_MCP_TOKEN apply to every command, not just mcp/chatto-*.
|
|
|
|
|
+ // Real environment variables take precedence over .env values.
|
|
|
|
|
+ loadEnv()
|
|
|
|
|
+
|
|
|
root := &cobra.Command{
|
|
root := &cobra.Command{
|
|
|
Use: "cheapo",
|
|
Use: "cheapo",
|
|
|
Short: "cheapo — free games lister (Go edition)",
|
|
Short: "cheapo — free games lister (Go edition)",
|
|
@@ -41,8 +46,8 @@ References: https://github.com/vogler/free-games-claimer
|
|
|
SilenceUsage: true,
|
|
SilenceUsage: true,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- root.PersistentFlags().StringVar(&flagCountry, "country", "DE", "ISO country code for store region (epic)")
|
|
|
|
|
- root.PersistentFlags().StringVar(&flagLocale, "locale", "de", "store locale (e.g. de, en-US)")
|
|
|
|
|
|
|
+ root.PersistentFlags().StringVar(&flagCountry, "country", "DE", "ISO country code for store region; determines currency/availability (epic only)")
|
|
|
|
|
+ root.PersistentFlags().StringVar(&flagLocale, "locale", "de", "display locale for Epic (formatting only, e.g. de -> '22,39 €', en-US -> '€22.39'; currency comes from --country)")
|
|
|
root.PersistentFlags().BoolVar(&flagJSON, "json", false, "output as JSON")
|
|
root.PersistentFlags().BoolVar(&flagJSON, "json", false, "output as JSON")
|
|
|
root.PersistentFlags().StringVar(&flagStore, "store", "all", "which store(s): epic, steam, gog, all")
|
|
root.PersistentFlags().StringVar(&flagStore, "store", "all", "which store(s): epic, steam, gog, all")
|
|
|
|
|
|
|
@@ -113,7 +118,13 @@ func printGames(cmd *cobra.Command, games []game.Game) error {
|
|
|
g.StartDate.Local().Format("02.01.2006 15:04"),
|
|
g.StartDate.Local().Format("02.01.2006 15:04"),
|
|
|
g.EndDate.Local().Format("02.01.2006 15:04"))
|
|
g.EndDate.Local().Format("02.01.2006 15:04"))
|
|
|
} else if !g.EndDate.IsZero() {
|
|
} else if !g.EndDate.IsZero() {
|
|
|
- fmt.Fprintf(out, " Free until: %s\n", g.EndDate.Local().Format("02.01.2006 15:04 (MST)"))
|
|
|
|
|
|
|
+ fmtStr := os.Getenv("CHEAPO_CLI_OUTPUT_DATE_FORMAT")
|
|
|
|
|
+ if fmtStr == "" {
|
|
|
|
|
+ fmtStr = time.RFC3339
|
|
|
|
|
+ }
|
|
|
|
|
+ loc := outputLocation("CHEAPO_CLI_OUTPUT_TIMEZONE", time.UTC)
|
|
|
|
|
+ s := g.EndDate.In(loc).Format(fmtStr)
|
|
|
|
|
+ fmt.Fprintf(out, " Free until: %s\n", s)
|
|
|
}
|
|
}
|
|
|
fmt.Fprintf(out, " %s\n", g.URL)
|
|
fmt.Fprintf(out, " %s\n", g.URL)
|
|
|
fmt.Fprintln(out)
|
|
fmt.Fprintln(out)
|