-
Notifications
You must be signed in to change notification settings - Fork 44
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
Implement bk pipeline create #274
Conversation
3774338
to
974bc03
Compare
RunE: func(cmd *cobra.Command, args []string) error { | ||
var repoURL string | ||
|
||
qs := []*survey.Question{ |
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.
The survey package we are using was deprecated in April!! 😢
We can keep using it for now and follow up with replacing it. On the readme it says to use bubbletea 😆
One cool thing we'll be able to do with that is use the huh package hide feature. That will gracefully allow us to accept flags or arguments to this command and build up a form to get the other fields from the user.
if len(repoURLS) > 0 { | ||
prompt := &survey.Select{ | ||
Message: "Choose a repository:", | ||
Options: repoURLS, | ||
} | ||
err := survey.AskOne(prompt, &repoURL, survey.WithValidator(survey.Required)) | ||
if err != nil { | ||
return err | ||
} | ||
} else { | ||
err := survey.AskOne(&survey.Input{Message: "Repository URL:"}, &repoURL, survey.WithValidator(survey.Required)) | ||
if err != nil { | ||
return err | ||
} |
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.
Should this be wrapped into line 45 so its all done at once?
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 could not find an option that would prompt if the options provided is empty. But maybe there is a way with bubbletea.
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.
Oh yeah it probably doesn't exist in this package. Something we can move to with bubbletea in the future maybe 👍
Co-authored-by: Jarryd Tilbrook <jarryd@buildkite.com>
bk pipeline create
command prompts for a pipeline name and description, then tries to resolve a git repo URL in its directory path. If no repo URL is resolved, it will prompt for a repo URL.