File tree Expand file tree Collapse file tree 5 files changed +15
-7
lines changed Expand file tree Collapse file tree 5 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -126,19 +126,19 @@ using the shorter alias
126126And for silence output, you can use ` -s ` or verbose ` --silence ` flags
127127
128128```
129- bnr watch-client -s
129+ bnr -s watch-client
130130```
131131
132132And you can use ` -p ` or verbose ` --path ` to specify a custom path of dotenv file
133133
134134```
135- bnr start-dev -- path=/custom/path/to/your/env/vars
135+ bnr -- path=/custom/path/to/your/env/vars start-dev
136136```
137137
138138Also use ` -e ` or verbose ` --encoding ` to specify the encoding of dotenv file
139139
140140```
141- bnr start-dev -- encoding=base64
141+ bnr -- encoding=base64 start-dev
142142```
143143
144144See [ envdot docs] ( https://github.com/motdotla/dotenv ) for more infomation
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- var program = require ( 'commander' ) ,
3- scriptName = process . argv [ 2 ] ;
2+ var program = require ( 'commander' ) ;
43
54program
65 . option ( '-e, --encoding [type]' , 'Specify the encoding of dotenv file' )
76 . option ( '-p, --path [type]' , 'Specify a custom path of dotenv file' )
87 . option ( '-s, --silent' , 'silent' )
98 . parse ( process . argv ) ;
9+ var scriptName = program . args [ 0 ] ;
1010
1111if ( ! program . silent ) {
1212 console . log ( 'running better-npm-run in' , process . cwd ( ) ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ module.exports = function exec(script, program) {
99
1010 require ( 'dotenv' ) . config ( dotenvConfig ) ;
1111
12- var argv = process . argv . splice ( 3 ) ,
12+ var argvIndex = - 1 ;
13+ firstArg = program . args [ 0 ] ;
14+ if ( firstArg !== undefined ) {
15+ argvIndex = process . argv . indexOf ( firstArg ) ;
16+ }
17+ var argv = argvIndex === - 1 ? [ ] : process . argv . splice ( argvIndex + 1 ) ,
1318 command = ( typeof script === 'string' ? script : script . command ) + ' ' + argv . join ( ' ' ) ;
1419
1520 script . env = script . env || { } ;
Original file line number Diff line number Diff line change 2020 "scripts" : {
2121 "test:env" : " node index.js test:env" ,
2222 "test:env-extend" : " TEST_ENV2=envvar node index.js test:env-extend" ,
23- "test:params" : " node index.js test:params --test" ,
23+ "test:params" : " node index.js --silent test:params --test" ,
2424 "test:command:object" : " node index.js test:command:object" ,
2525 "test:command:string" : " node index.js test:command:string" ,
2626 "test:silent" : " node index.js test:command:object -s && node index.js test:command:object --silent" ,
Original file line number Diff line number Diff line change 1+ if ( process . argv [ 2 ] === "--silent" ) {
2+ throw new Error ( 'it should eat extra arguments' ) ;
3+ }
14if ( process . argv [ 2 ] !== "--test" ) {
25 throw new Error ( 'it should accept params' ) ;
36}
You can’t perform that action at this time.
0 commit comments