-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat: specify add-on options in command args #543
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
base: main
Are you sure you want to change the base?
Conversation
|
commit: |
Ah, interesting catch on the paraglide add-on. The only other option I can think of is to do what CSV does when there's a comma and wrap that value in quotes:
|
That's an interesting idea that could work! Another idea that might work would be to eliminate the ambiguity of specifying options which would act as it's own separator as well: sv add paraglide=languageTags:en,es,de,demo:no
sv add drizzle=database:postgres,client:postgres.js,docker:yes However, it's a bit more verbose and can get awkward around the |
Adding the option name in there does make things clearer. Though it's still a little hard to read since
|
Sadly the quotes method ( You can view this in action by running
Good point! Using a edit: Using a |
I've updated the PR to now use the |
Generally, this seems like the perfect solution. We should have found that way earlier. It's way more descriptive and more clear what you are actually trying to achieve. Also the first tests seemed pretty successful. But this currently fails for me
Probably because it does not know if the comma should separate an option or an option value (like for tailwind forms). Alternatively, this might be on of those things that's only happening on windows. The same goes for this one:
Alternatively, I'm just not aware of the correct syntax.
I wouldn't necessarily deem this as obligatory. Based on the docs Ben drafted, this should be pretty clear how to use them. |
Running this line works perfectly for me on linux, so I'm going to guess it's Windows 🙃. Will take a closer look in a few. |
Here is a stack trace if you want:
The second paraglide option actually installs the demo, even though it's explicitly set to no. But this one does not throw an error |
partially implements #528 (although i'm moreso playing around with this idea atm)
While similar to #528, there's a minor difference when it comes to bailing/defaults:
I also had to configure our own
formatHelp
method to add a new help field that nicely displays the add-on options:It would also be nice to have an example on how to apply them (e.g.
Usage: sv add drizzle=database:postgresql,client:postgres.js,docker:yes
), but I'm not exactly sure where that should go in the help text just yet.Issues
Note
This has been resolved by requiring options to be listed with the
<name>:<value>
format (e.g.sv add addon=option:value
)I didn't notice this before, but the
paraglide
add-on is a bit of a nuisance when it comes to specifying its options. This is because one of its options prompts for arbitrary user input.For example, how do we parse this?
Since add-on options are delimited by
,
's andparaglide
uses a,
to delimit its own user input, how should we parse this? I'm not exactly sure yet, but this is an issue that occurs to this day with our current add-on option flags format:--paraglide=en,de,demo
. I guess one option would be to choose a new delimiter for theparaglide
add-on. Alternatively, we could change it to a;
for the add-on args (e.g.sv add paraglide=en,de;no-demo
).