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

issue_raised_when_creating_a_react_project #31

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

whitewizardd
Copy link

i implemented a support so as to reduce the verbosity when creating a react project...

match create_react_app(dir.dir_name.clone()) {
ScaffoldSubCommand::React(dir) => {
let result = match collect_arguement_from_the_terminal().trim() {
"j" => create_react_app(dir.dir_name.clone()),
Copy link
Owner

Choose a reason for hiding this comment

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

The create_react_app() function returns a Result enum, you will have to have each variant

ScaffoldSubCommand::React(dir) => {
let result = match collect_arguement_from_the_terminal().trim() {
"j" => create_react_app(dir.dir_name.clone()),
"t" => create_react_app_with_typescript(dir.dir_name.clone()),
Copy link
Owner

Choose a reason for hiding this comment

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

Similarly the create_react_app_with_typescript() returns a Result enum, handle all variants.

@@ -248,6 +243,18 @@ pub fn resolve(args: ClapperArgs) -> Result<(), Box<dyn Error>> {
Ok(())
}

fn collect_arguement_from_the_terminal() -> String {
Copy link
Owner

Choose a reason for hiding this comment

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

There is already an existing pattern of getting command line inputs, don't reinvent the wheel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants