Conversation
85e768c to
367baac
Compare
367baac to
8bdde7c
Compare
nicktate
left a comment
There was a problem hiding this comment.
This is looking good so far, left a first round of comments inline. We don't have to do it as part of this PR but we should consider integrating with the new commands/charm library for interactive elements
|
|
||
| appSpec.Name = name | ||
| var funcSpecArray []*godo.AppFunctionsSpec | ||
| for _, component := range resp.Components { |
There was a problem hiding this comment.
We should add a warning message stating other component types are not yet supported if we encounter them in the spec.
| // output is global flag | ||
| detect := CmdBuilder(cmd, | ||
| RunAppsDetect, "detect", "Detect functions", "Detect functions project and convert it into apps project by adding the AppSpec.", Writer, aliasOpt("dt")) | ||
| AddStringFlag(detect, doctl.ArgProjectSource, "", "", `Project source.`) |
There was a problem hiding this comment.
We should check if we are currently in a git project directory and attempt to default to that source repo.
| return err | ||
| } | ||
|
|
||
| func (s *appsService) Detect(source string, sha string, name string, branch string, autoDeploy bool) (*godo.AppSpec, error) { |
There was a problem hiding this comment.
I think we should consider changing this signature to only inline required parameters and put the rest in an options struct. e.g.:
type DetectOpts struct {
Name string // random name generated by default
Sha string // latest sha in branch by default
AutoDeploy bool // False by default
}
func (s *appsService) Detect(source, branch string, opts DetectOpts) (*godo.AppSpec, error) {
| if err != nil { | ||
| return err | ||
| } | ||
| if len(c.Args) > 0 { |
There was a problem hiding this comment.
I don't think we need argument parsing here if we are including auto-deploy as a flag as well.
| } | ||
|
|
||
| switch Output { | ||
| case "json": |
There was a problem hiding this comment.
We should support YAML here as well
| e.SetIndent("", " ") | ||
| return e.Encode(spec) | ||
| case "text": | ||
| return nil |
There was a problem hiding this comment.
(assuming this is just not implemented yet) just a reminder to either error out if not supported or implemented output support
Co-authored-by: Nick Tate <ntate22@gmail.com>
Co-authored-by: Nick Tate <ntate22@gmail.com>
Co-authored-by: Nick Tate <ntate22@gmail.com>
|
This PR has been de-prioritized and will receive the necessary attention when capacity is allotted. |
The PR adds a sub-command
Detectunder apps. The command allows to import of a functions project and returns the AppSpec for that project.Later then AppSpec can be used to create an Apps project.