Skip to content

Commit

Permalink
Detect number of parameters, exit if less then 2.
Browse files Browse the repository at this point in the history
Without this detection,

if a user gives no parameter, the error message will be:
> shift: can't shift that many

if a user gives no package name, the error message will be:
>  ! Cannot read property 'dependencies' of undefined

Tell the users to pass at least 2 parameters and then print `pnpm-install --help` to improve the UX.
  • Loading branch information
PeterDaveHello committed Jan 31, 2016
1 parent 3bf61be commit af427d0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/pnpm
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env sh

if [ "$#" -lt "2" ]; then
echo "You should pass at least 2 parameters to pnpm" 1>&2
pnpm-install --help
exit 1
fi

cmd=$1
shift
args=$*
Expand Down

0 comments on commit af427d0

Please sign in to comment.