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

Exit code 0, but arbitrary error messages with no matches #44

Open
konsalex opened this issue Sep 18, 2023 · 3 comments
Open

Exit code 0, but arbitrary error messages with no matches #44

konsalex opened this issue Sep 18, 2023 · 3 comments

Comments

@konsalex
Copy link

konsalex commented Sep 18, 2023

Hey folks,

The DX is a bit confusing when there are no matches, as the exit code is indeed 0 which is great, but the output for an example command:
fastmod -- '--palette-(dark)-([\w-]+)' '--theme-${1}-palette-${2}' -g '!base.css' -g '*.{tsx,ts,js,jsx,css,pcss}' ./src

would be:

Warning: -g: No such file or directory (os error 2)
Warning: !base.css: No such file or directory (os error 2)
Warning: -g: No such file or directory (os error 2)
Warning: *.{tsx,ts,js,jsx,css,pcss}: No such file or directory (os error 2)

which took me quite some time to figure out that indeed it run smoothly, the selectors just did not match anything.

Am I doing something wrong myself maybe?

Edit:

I get this only on times that I need to prepend with -- to avoid throwing with --palette for example

@swolchok
Copy link
Contributor

swolchok commented Sep 18, 2023 via email

@konsalex
Copy link
Author

@swolchok without the double hyphen I get to an issue:

error: Found argument '--palette-(dark)-([\w-]+)' which wasn't expected, or isn't valid in this context

Then to solve this I try to escape the hyphens:

fastmod '\-\-palette-(dark)-([\w-]+)' '\-\-theme-${1}-palette-${2}' -g '!base.css' -g '*.{tsx,ts,js,jsx,css,pcss}' ./src

and this one leads to weird replacement

-                 color: "var(--palette-dark-neutral-bg)",
+                 color: "var(\-\-theme-dark-palette-neutral-bg)",

Do you have any clue how this one can be resolved?

@swolchok
Copy link
Contributor

I think moving the flags before the double hyphen should do it:
fastmod -g '!base.css' -g '*.{tsx,ts,js,jsx,css,pcss}' -- '--palette-(dark)-([\w-]+)' '--theme-${1}-palette-${2}' ./src

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

No branches or pull requests

2 participants