-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
Detect number of parameters, exit if less then 2. #47
Conversation
Oh wait. This is actually incorrect... "Pnpm install" will read package.json and install whatever's on there. Except in your case, package.json is absent so it can't read "dependencies" from it (hence the error). It was actually correct behavior, albeit with an unhelpful message. |
(For "pnpm install" anyway) |
But yeah, "pnpm" with no args should default to something, and not give an error, which it probably does right now |
Without this detection, if a user gives no parameter, the error message will be: > shift: can't shift that many Tell the users to pass at least 1 parameters and then print `pnpm-install --help` to improve the UX.
af427d0
to
cc0fba2
Compare
Sorry, I am so careless that I forgot it, just updated, thanks. |
Anything I need to change now? |
@@ -1,4 +1,11 @@ | |||
#!/usr/bin/env sh | |||
|
|||
if [ "$#" -lt "1" ]; then | |||
echo "You should pass at least 1 parameter to pnpm" 1>&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably eventually show a help screen like npm --help
... but for another time; for now this is gold
Thanks! |
Detect number of parameters, exit if less then 2.
* fix: flatten by alias * fix: rename field, other fixes * fix: more bug fixes * fix: make all tests run, write a (failing) test for pruning * fix: reflatten after pruning * fix: do not log installation/removal of hoisted aliases * fix: follow review comments * fix: use muteLogs instead of skipLogs
Without this detection,
if a user gives no parameter, the error message will be:
Tell the users to pass at least 1 parameter and then print
pnpm-install --help
to improve the UX.