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

Detect number of parameters, exit if less then 2. #47

Merged
merged 1 commit into from
Jan 31, 2016

Conversation

PeterDaveHello
Copy link
Contributor

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 parameter and then print pnpm-install --help to improve the UX.

@rstacruz
Copy link
Member

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.

@rstacruz
Copy link
Member

(For "pnpm install" anyway)

@rstacruz
Copy link
Member

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.
@PeterDaveHello
Copy link
Contributor Author

Sorry, I am so careless that I forgot it, just updated, thanks.

@PeterDaveHello
Copy link
Contributor Author

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
Copy link
Member

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

@rstacruz
Copy link
Member

Thanks!

rstacruz added a commit that referenced this pull request Jan 31, 2016
Detect number of parameters, exit if less then 2.
@rstacruz rstacruz merged commit 2d0b515 into pnpm:master Jan 31, 2016
@PeterDaveHello PeterDaveHello deleted the patch-1 branch February 1, 2016 05:32
zkochan pushed a commit that referenced this pull request May 11, 2018
* 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
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.

None yet

2 participants