Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/account/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"os"
"time"

"github.com/mexcool/simplelogin-cli/internal/api"
"github.com/mexcool/simplelogin-cli/internal/auth"
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions internal/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading