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

Fixes spaces in project name #176

Merged
merged 11 commits into from
Jan 6, 2025
Merged

Fixes spaces in project name #176

merged 11 commits into from
Jan 6, 2025

Conversation

rin-st
Copy link
Member

@rin-st rin-st commented Dec 20, 2024

An error appears here only when used foundry with project name with spaces at the end. It throws because / (space + /) is interpreted as separation between arguments. All other variants " a", "a b" etc works as expected

So idea is to restrict space usage at the end of the project name and allow all others

I added a check when prompting for a name: you can't go the next steps until you have no spaces/tabs at the end of the project name. Also added project field reset for adventurers who will try to deceive cli and try to use something like yarn cli "space-at-the-end "

Screen.Recording.2024-12-20.at.17.22.43.mov

how it looks with the extension
image

Fixes #150

Copy link
Collaborator

@technophile-04 technophile-04 left a comment

Choose a reason for hiding this comment

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

Thanks @rin-st really nice!! and works great! And happy to merge as it 🙌

Was just researching on DX from other create CLI's

  1. Regarding project path, I liked how create-next-app is validating the path.

  2. Initially I thought maybe we should ourselves trim leading and inital space (being forgiving) but looking at other CLI they don't do it and show Invalid project path like us now 🙌 so need to change anything.

On point 1 should we use that? Maybe it's a bit overpowered but worth it and more robust / future proof. Saying this because maybe in future user entering some weird path might break CLI (can be caused if use some other lib in create-eth cli is not able to parse or maybe some foundry changes)

Also its shows warning on specific stuff whats wrong:

Space errror :

Screenshot 2024-12-30 at 11 29 05 AM

Weird char which might cause issue

Screenshot 2024-12-30 at 11 29 53 AM

@rin-st
Copy link
Member Author

rin-st commented Jan 3, 2025

Thanks Shiv!

I copied their validate function so now cli shows all the errors at the start. But when prompting it shows only one error (same as in create-next-app) since if we want to show all it requires to add workarounds and I think it's not worth it.

How it works now:

Screen.Recording.2025-01-03.at.17.54.11.mov

@technophile-04
Copy link
Collaborator

But when prompting it shows only one error (same as in create-next-app) since if we want to show all it requires to add workarounds and I think it's not worth it.

Yup yup not worth it and the current version feels nice too so no required!

Thanks @rin-st!! Merging this 🙌

@technophile-04 technophile-04 merged commit 4db867d into main Jan 6, 2025
1 check passed
@technophile-04 technophile-04 deleted the fix-spaces-in-name branch January 6, 2025 08:27
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.

spaces in repo name gives error
2 participants