8000 feat!: add table format to 'coder license ls' by Emyrk · Pull Request #8421 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat!: add table format to 'coder license ls' #8421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix typo, exclude 0 claims
  • Loading branch information
Emyrk committed Jul 12, 2023
commit a4e475c97d549ea17d965b42475b0bdf8e8e78e5
2 changes: 1 addition & 1 deletion codersdk/licenses.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (l *License) ExpiresAt() (time.Time, error) {
return time.Time{}, xerrors.Errorf("license_expires claim has unexpected type %T", expClaim)
}

func (l *License) Trail() bool {
func (l *License) Trial() bool {
if trail, ok := l.Claims["trail"].(bool); ok {
return trail
}
Expand Down
15 changes: 10 additions & 5 deletions enterprise/cli/licenses.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,15 @@ func (r *RootCmd) licensesList() *clibase.Cmd {
} else {
var strs []string
if lic.AllFeaturesClaim() {
strs = append(strs, "all")
}
for k, v := range features {
strs = append(strs, fmt.Sprintf("%s=%v", k, v))
// If all features are enabled, just include that
strs = append(strs, "all features")
} else {
for k, v := range features {
if v > 0 {
// Only include claims > 0
strs = append(strs, fmt.Sprintf("%s=%v", k, v))
}
}
}
formattedFeatures = strings.Join(strs, ", ")
}
Expand All @@ -181,7 +186,7 @@ func (r *RootCmd) licensesList() *clibase.Cmd {
UploadedAt: lic.UploadedAt,
Features: formattedFeatures,
ExpiresAt: exp,
Trial: lic.Trail(),
Trial: lic.Trial(),
})
}
return out, nil
Expand Down
0