Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Should sapper CLI warn about unknown arguments? #729

Closed
ludwigschubert opened this issue Jun 7, 2019 · 9 comments · Fixed by #733
Closed

Should sapper CLI warn about unknown arguments? #729

ludwigschubert opened this issue Jun 7, 2019 · 9 comments · Fixed by #733

Comments

@ludwigschubert
Copy link

I just ran sapper export --basename […] a bunch of times before noticing I wanted basepath instead.

@Conduitry
Copy link
Member

In a quick skim through the Sade readme I didn't see anything that would automatically support this - @lukeed is this currently possible? Or does the opts argument to an action get the entire object of options - including unknown ones - and we could throw an error at that point?

@lukeed
Copy link
Member

lukeed commented Jun 8, 2019

It's available through mri, which is accessible through sade.parse options.

@lukeed
Copy link
Member

lukeed commented Jun 8, 2019

Forgot to address the other half of question sorry (😴was still waking up)

I improved sade & mri's coordination for opts.unknown handling. Tagged a new v1.5.0 on sade's side of things as it will now print your custom (or its default) message when an unknown flag was found. Check out the new docs and/or the release notes.

If you don't define an unknown handler, then all arguments are parsed & passed thru to the command. That part is unchanged

@Conduitry
Copy link
Member

Fixed in 0.27.5.

@Conduitry
Copy link
Member

We had to revert this because of --legacy being seen as an unknown option. Reopening this. I think this is a bug in Sade but will need to investigate later.

@Conduitry Conduitry reopened this Jul 28, 2019
Conduitry added a commit that referenced this issue Jul 28, 2019
@Conduitry
Copy link
Member

Re-fixed in 0.27.8

@lukeed
Copy link
Member

lukeed commented Jul 29, 2019

lukeed/sade@ec5e06d

@alexdilley
Copy link

I use dotenv-flow which can interpret a --node-env switch passed to node scripts. Following this change, it's now not possible to pass this argument. I can work around dotenv-flow but I just wanted to flag that you may possibly receive noise because of this change since it may not be unusual to want to pass arbitrary options for interpretation by third-party libs.

@pngwn
Copy link
Member

pngwn commented Aug 7, 2019

I don't think it is Sapper's responsibility to handle this case as it comes at the cost of User Experience for Sapper users as in the example listed in this issue. I don't think that passing arbitrary arguments to a CLI would generally be expected to work nor do I believe it is a common practice with Sapper (I could be wrong, but most people probably don't even touch the scripts at all). We can add information about unknown props to the Sapper docs, dealing with any other support issues as they occur shouldn't be a problem.

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

Successfully merging a pull request may close this issue.

5 participants