-
Notifications
You must be signed in to change notification settings - Fork 26
CLI using cobra #2
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
Subcommands are implemented as methods on runners type, which holds dependencies. Integration tests with ginkgo run against an API.
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.
This is awesome! I see no reason not to merge and continue to iterate on this.
One thing I'm concerned about is consistency in usage (use, short, and long).
Another thing I'd love to see is better godoc around the client package so its more useful for other devs. I'm not sure if the fact that its generated will make it useless. May be a reason to commit generated code to the repo? A link to the godoc in readme would be good too.
A cool thing we did with replicated on-prem cli is cobra allows docs generation from usage. See https://github.com/replicatedcom/replicated/blob/ed696f2af241a28619da514462739b94fe5ed897/Makefile#L79-L81. Possibly this and client godoc would be good additions to reference section of docs. https://www.replicated.com/docs/reference/
runCmds.api = api | ||
|
||
if appSlug == "" { | ||
appSlug = os.Getenv("REPLICATED_APP_SLUG") |
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.
it would be nice to be able to set id or slug
cli/cmd/release.go
Outdated
// releaseCmd represents the release command | ||
var releaseCmd = &cobra.Command{ | ||
Use: "release", | ||
Short: "manage app releases", |
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.
caps
cli/cmd/release_create.go
Outdated
|
||
var releaseCreateCmd = &cobra.Command{ | ||
Use: "create", | ||
Short: "create a new release", |
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.
caps
cli/cmd/release_inspect.go
Outdated
// releaseInspectCmd represents the inspect command | ||
var releaseInspectCmd = &cobra.Command{ | ||
Use: "inspect", | ||
Short: "replicated release inspect <sequence>", |
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.
Print the YAML config for a release
var updateReleaseYaml string | ||
|
||
var releaseUpdateCmd = &cobra.Command{ | ||
Use: "update SEQUENCE", |
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.
make use consistent
see promote <sequence> <channelID>
cli/cmd/channel_rm.go
Outdated
var channelRmCmd = &cobra.Command{ | ||
Use: "rm <id>", | ||
Short: "Remove (archive) a channel", | ||
Long: `replicated channel rm 4d3d240ea1ec4dab0be3b2105ff4b4ed`, |
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.
lets remove long descriptions that echo command
channelCmd.AddCommand(channelInspectCmd) | ||
} | ||
|
||
func (r *runners) channelInspect(cmd *cobra.Command, args []string) error { |
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.
im concerned about how parseable this output is. a lot of ppl will use cli for automation
return err | ||
} | ||
|
||
return print.Channels(r.w, allChannels) |
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.
would be awesome if printers supported formats eg tabs, json, yaml
cli/cmd/channel_inspect.go
Outdated
var channelInspectCmd = &cobra.Command{ | ||
Use: "inspect", | ||
Short: "Show full details for a channel", | ||
Long: `replicated channel inspect be52315888f23408e2e4dc9242d4cc2c`, |
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.
lets remove long descriptions that echo command
I fixed the short/long/use help text. Still todo:
|
@areed wanna create issues in github? |
added |
Subcommands are implemented as methods on runners type, which holds
dependencies.
Integration tests with ginkgo run against an API.