-
Notifications
You must be signed in to change notification settings - Fork 889
feat: Add "projects list" command to the CLI #333
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
Conversation
e91a6fa
to
a13221b
Compare
Codecov Report
@@ Coverage Diff @@
## main #333 +/- ##
==========================================
- Coverage 67.44% 67.30% -0.14%
==========================================
Files 142 143 +1
Lines 7710 7806 +96
Branches 77 77
==========================================
+ Hits 5200 5254 +54
- Misses 1981 2014 +33
- Partials 529 538 +9
Continue to review full report at Codecov.
|
1bd421f
to
9efe4ca
Compare
This adds a WorkspaceOwnerCount parameter returned from the projects API. It's helpful to display the amount of usage a specific project has.
9efe4ca
to
8571e24
Compare
@@ -67,7 +67,7 @@ func login() *cobra.Command { | |||
if !isTTY(cmd) { | |||
return xerrors.New("the initial user cannot be created in non-interactive mode. use the API") | |||
} | |||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s Your Coder deployment hasn't been set up!\n", color.HiBlackString(">")) | |||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s Your Coder deployment hasn't been set up!\n", caret) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like factoring out the caret
, nice improvement 👍
|
||
if len(projects) == 0 { | ||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s No projects found in %s! Create one:\n\n", caret, color.HiWhiteString(organization.Name)) | ||
_, _ = fmt.Fprintln(cmd.OutOrStdout(), color.HiMagentaString(" $ coder projects create <directory>\n")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing the caret
refactoring made me think about is if we'd also want to have a helper for the prompt string $
- mainly because we may want to show something different on Windows. But not a big deal!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
color.WhiteString("Archive"), | ||
color.WhiteString(project.UpdatedAt.Format("January 2, 2006")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could log issues to track this missing data, if it's not yet available. Might be good starter issues to on-board other developers here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is there, but the formatting string makes it look weird here hahaha. This actually outputs the proper dates!
// Project is the JSON representation of a Coder project. | ||
// This type matches the database object for now, but is | ||
// abstracted for ease of change later on. | ||
type Project database.Project | ||
type Project struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, looks like some extra fields we can put in the UI table to make it look more interesting now, too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed!
This adds a WorkspaceOwnerCount parameter returned from the
projects API. It's helpful to display the amount of usage
a specific project has.