diff --git a/internal/pkg/create/create.go b/internal/pkg/create/create.go index 46546d796..0a2973bc4 100644 --- a/internal/pkg/create/create.go +++ b/internal/pkg/create/create.go @@ -5,6 +5,15 @@ import ( "time" ) +type Param struct { + GithubUsername string + GithubToken string + DockerhubUsername string + DockerhubToken string + Language string + Framework string +} + func Create() error { helloMsg := func() { fmt.Println("I'll scaffold a new repository for you.") @@ -16,26 +25,30 @@ func Create() error { } helloMsg() - lang, err := getLanguage() + params, err := getParams() if err != nil { return err } - time.Sleep(time.Second) - fmt.Println("\nPlease choose a framework next.") - time.Sleep(time.Second) + return create(params) +} - fram, err := getFramework() +// TODO: @jf +func create(params *Param) error { + err := createRepo(params) if err != nil { return err } - return createRepo(lang, fram) - // TODO(daniel-hutao): cicd + return createApp(params) } // TODO(daniel-hutao): support python/flask first -func createRepo(lang, fram string) error { - fmt.Printf("Lang: %s, Fram: %s\n", lang, fram) +func createRepo(params *Param) error { + fmt.Printf("Lang: %s, Fram: %s\n", params.Language, params.Framework) + return nil +} + +func createApp(params *Param) error { return nil } diff --git a/internal/pkg/create/param.go b/internal/pkg/create/param.go new file mode 100644 index 000000000..f2c4cd20b --- /dev/null +++ b/internal/pkg/create/param.go @@ -0,0 +1,27 @@ +package create + +import ( + "fmt" + "time" +) + +// TODO: @bird +func getParams() (*Param, error) { + lang, err := getLanguage() + if err != nil { + return nil, err + } + + time.Sleep(time.Second) + fmt.Println("\nPlease choose a framework next.") + time.Sleep(time.Second) + + fram, err := getFramework() + if err != nil { + return nil, err + } + return &Param{ + Language: lang, + Framework: fram, + }, nil +}