diff --git a/cmd/account/status.go b/cmd/account/status.go index fae7432..a8ad9b7 100644 --- a/cmd/account/status.go +++ b/cmd/account/status.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "os" + "time" "github.com/mexcool/simplelogin-cli/internal/api" "github.com/mexcool/simplelogin-cli/internal/auth" @@ -97,7 +98,12 @@ func runStatus(cmd *cobra.Command, args []string) error { fmt.Fprintf(os.Stdout, "%s %s\n", output.Bold.Sprint("Premium:"), premium) if info.InTrial { - fmt.Fprintf(os.Stdout, "%s %s\n", output.Bold.Sprint("Trial:"), output.Yellow.Sprint("active")) + trialLabel := output.Yellow.Sprint("active") + if info.TrialEndTimestamp != nil { + end := time.Unix(*info.TrialEndTimestamp, 0).UTC().Format("2006-01-02") + trialLabel = output.Yellow.Sprintf("active (ends %s)", end) + } + fmt.Fprintf(os.Stdout, "%s %s\n", output.Bold.Sprint("Trial:"), trialLabel) } fmt.Fprintln(os.Stdout) diff --git a/internal/api/client.go b/internal/api/client.go index aedc925..7f3dd51 100644 --- a/internal/api/client.go +++ b/internal/api/client.go @@ -174,12 +174,13 @@ func HandleError(statusCode int, body []byte, action string) error { // UserInfo represents user information. type UserInfo struct { - Name string `json:"name"` - Email string `json:"email"` - IsPremium bool `json:"is_premium"` - InTrial bool `json:"in_trial"` - ProfilePicURL string `json:"profile_picture_url"` - MaxAliasFreePlan int `json:"max_alias_free_plan"` + Name string `json:"name"` + Email string `json:"email"` + IsPremium bool `json:"is_premium"` + InTrial bool `json:"in_trial"` + TrialEndTimestamp *int64 `json:"trial_end_timestamp"` + ProfilePicURL string `json:"profile_picture_url"` + MaxAliasFreePlan int `json:"max_alias_free_plan"` } // GetUserInfo retrieves the current user's information.