瀏覽代碼

cli: honor CHEAPO_CLI_OUTPUT_DATE_FORMAT for 'Free until' (default ISO)

Paul Klumpp 2 天之前
父節點
當前提交
6d1d526e74
共有 1 個文件被更改,包括 6 次插入 和 1 次删除
  1. 6 1
      cmd/cheapo/main.go

+ 6 - 1
cmd/cheapo/main.go

@@ -113,7 +113,12 @@ func printGames(cmd *cobra.Command, games []game.Game) error {
 				g.StartDate.Local().Format("02.01.2006 15:04"),
 				g.EndDate.Local().Format("02.01.2006 15:04"))
 		} else if !g.EndDate.IsZero() {
-			fmt.Fprintf(out, "   Free until: %s\n", g.EndDate.UTC().Format(time.RFC3339))
+			fmtStr := os.Getenv("CHEAPO_CLI_OUTPUT_DATE_FORMAT")
+			if fmtStr == "" {
+				fmtStr = time.RFC3339
+			}
+			s := g.EndDate.UTC().Format(fmtStr)
+			fmt.Fprintf(out, "   Free until: %s\n", s)
 		}
 		fmt.Fprintf(out, "   %s\n", g.URL)
 		fmt.Fprintln(out)