Skip to content

Commit

Permalink
init with multiple lang
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy committed Feb 1, 2025
1 parent 1adb737 commit b73f061
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/app/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ type input struct {

var LanguageChoice = input{
prompt: "Choose a programming language",
inputType: SINGLE_SELECT,
inputType: MULTIPLE_SELECT,
label: LabelLanguage,
options: []string{
"python",
"r",
"r_lang",
"julia",
},
}
Expand Down Expand Up @@ -227,9 +227,13 @@ func generateFile(clicontext *cli.Context) error {
var buf bytes.Buffer
buf.WriteString("def build():\n")
buf.WriteString(fmt.Sprintf("%sbase(image=\"ubuntu:22.04\", dev=True)\n", indentation))
if len(selectionMap[LabelLanguage]) > 0 && selectionMap[LabelLanguage][0] == "python" {
buf.WriteString(fmt.Sprintf("%sinstall.conda()\n", indentation))
buf.WriteString(fmt.Sprintf("%sinstall.python()\n", indentation))
for _, lang := range selectionMap[LabelLanguage] {
if lang == "python" {
buf.WriteString(fmt.Sprintf("%sinstall.conda()\n", indentation))
buf.WriteString(fmt.Sprintf("%sinstall.python()\n", indentation))
} else {
buf.WriteString(fmt.Sprintf("%sinstall.%s()\n", indentation, lang))
}
}
buf.WriteString(generatePackagesStr("python", selectionMap[LabelPythonPackage]))
buf.WriteString(generatePackagesStr("r", selectionMap[LabelRPackage]))
Expand Down

0 comments on commit b73f061

Please sign in to comment.