@@ -26,8 +26,8 @@ const Util = require('./lib/util');
2626const yargs = require ( 'yargs' )
2727 . wrap ( null )
2828 . usage ( 'Usage: $0 [options]' )
29- . option ( 'n' , { alias : 'businessNetworkName' , describe : 'The business network identifier' , type : 'string' , default : process . env . COMPOSER_BUSINESS_NETWORK } )
3029 . option ( 'p' , { alias : 'connectionProfileName' , describe : 'The connection profile name' , type : 'string' , default : process . env . COMPOSER_CONNECTION_PROFILE } )
30+ . option ( 'n' , { alias : 'businessNetworkName' , describe : 'The business network identifier' , type : 'string' , default : process . env . COMPOSER_BUSINESS_NETWORK } )
3131 . option ( 'i' , { alias : 'enrollId' , describe : 'The enrollment ID of the user' , type : 'string' , default : process . env . COMPOSER_ENROLLMENT_ID } )
3232 . option ( 's' , { alias : 'enrollSecret' , describe : 'The enrollment secret of the user' , type : 'string' , default : process . env . COMPOSER_ENROLLMENT_SECRET } )
3333 . option ( 'N' , { alias : 'namespaces' , describe : 'Use namespaces if conflicting types exist' , type : 'string' , default : process . env . COMPOSER_NAMESPACES || 'always' , choices : [ 'always' , 'required' , 'never' ] } )
@@ -37,9 +37,16 @@ const yargs = require('yargs')
3737 . alias ( 'h' , 'help' )
3838 . argv ;
3939
40- // see if we need to run interactively
40+ // See if we need to run interactively.
41+ // We check to see if no command line arguments have been supplied,
42+ // and then check to see that none of the required arguments have
43+ // been supplied via environment variables have been specified either.
44+ const interactive = process . argv . slice ( 2 ) . length === 0 && // No command line arguments supplied.
45+ [ 'n' , 'p' , 'i' , 's' ] . every ( ( flag ) => {
46+ return yargs [ flag ] === undefined ;
47+ } ) ;
4148let promise ;
42- if ( process . argv . slice ( 2 ) . length === 0 ) {
49+ if ( interactive ) {
4350 // Gather some args interactively
4451 clear ( ) ;
4552 console . log (
0 commit comments