Skip to content
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

Interactive cli #1294

Merged
merged 15 commits into from
Dec 13, 2022
Merged

Interactive cli #1294

merged 15 commits into from
Dec 13, 2022

Conversation

AlexXi19
Copy link
Member

@AlexXi19 AlexXi19 commented Dec 12, 2022

#706

messed up the git history for the previous pr

Interactive CLI to generate build.envd (Proof of Concept)

  • Asks user questions and generates build.envd based on the user's answers

  • Used bubbletea to create the TUI and bubbles to style the TUI.

  • Supports single selection and multiple selection.

Interface for the developers

Create a data structure to define a new question

func LanguageChoice() input {
	return input{
		prompt:    "Choose a programming language",
		inputType: SINGLE_SELECT,
		label:     LabelLanguage,
		options: []string{
			"python",
			"r",
			"julia",
		},
	}
}

Add question to demoCommand, further define question flow using conditional statements. The user's selection will be added to selectionMap using your defined label.

	startQuestion(LanguageChoice())
	if selectionMap[LabelLanguage][0] == "python" {
		startQuestion(PythonPackageChoice())
	} else if selectionMap[LabelLanguage][0] == "r" {
		startQuestion(RPackageChoice())
	}

Use the user's selection from selectionMap and add your codegen logic to generateFile

Demo

ezgif-2-ad21c83847

Testing

Can add testing later after finalizing the choices.

AlexXi19 and others added 11 commits December 11, 2022 19:13
* feat: add name to envd envs describe

Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>

* chore: move label name logic to ListEnvPortBinding

Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>

* chore: move label logic to NewPortBindingFromContainerJson

Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>

* chore: add name to envdserver port binding

Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>

Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
@gaocegege
Copy link
Member

The demo looks promising!

/cc @kemingy @VoVAllen

@muniu-bot muniu-bot bot requested review from kemingy and VoVAllen December 12, 2022 04:14
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
@kemingy
Copy link
Member

kemingy commented Dec 12, 2022

Is it ready to review?

@AlexXi19
Copy link
Member Author

Is it ready to review?

Yes I think so

e2e/v0/cli/init_test.go Outdated Show resolved Hide resolved
pkg/app/interactive.go Outdated Show resolved Hide resolved
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
@AlexXi19
Copy link
Member Author

@kemingy addressed the comments, please take a look!

kemingy
kemingy previously approved these changes Dec 12, 2022
Copy link
Member

@kemingy kemingy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@muniu-bot muniu-bot bot added the lgtm label Dec 12, 2022
pkg/app/init.go Outdated Show resolved Hide resolved
Signed-off-by: AlexXi19 <alex2001314jjj@gmail.com>
@muniu-bot muniu-bot bot removed the lgtm label Dec 12, 2022
@gaocegege
Copy link
Member

/lgtm
/approve

Thanks for your contribution! 🎉 👍

@muniu-bot muniu-bot bot added the lgtm label Dec 13, 2022
@gaocegege gaocegege merged commit 935e55d into tensorchord:main Dec 13, 2022
@AlexXi19 AlexXi19 deleted the interactive-cli branch December 17, 2022 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants