@@ -40,9 +40,23 @@ module.exports = (cmds, app, data, lando) => _.map(cmds, cmd => {
4040 // Discover the service
4141 const service = getService ( cmd , data , app . _defaultService ) ;
4242
43+ // compute stdio based on compose major version
44+ const cstdio = _ . get ( app , '_config.orchestratorMV' , 2 ) ? 'inherit' : [ 'inherit' , 'pipe' , 'pipe' ] ;
45+
46+ // attempt to ascertain the SAPI
47+ const sapi = _ . get ( app , 'v4.services' , [ ] ) . find ( s => s . id === service ) ?. api
48+ ?? _ . get ( app , `sapis.${ service } ` , undefined )
49+ ?? _ . get ( data , `sapis.${ service } ` , undefined ) ;
50+
51+ // normalize cmd
52+ cmd = getCommand ( cmd ) ;
53+
54+ // if array then just join it together
55+ if ( _ . isArray ( cmd ) ) cmd = cmd . join ( ' ' ) ;
56+
4357 if ( 'lando' === service ) {
4458 const yargs = require ( 'yargs' ) ;
45- const argv = yargs ( _ . isArray ( command ) ? command . join ( ' ' ) : command ) . parse ( ) ;
59+ const argv = yargs ( cmd ) . parse ( ) ;
4660 const $0 = _ . pullAt ( argv . _ , [ 0 ] ) [ 0 ] ;
4761 const toolingTask = _ . find ( app . tasks , task => $0 === task . command ) ;
4862 argv . _eventArgs = argv . _ ;
@@ -59,20 +73,6 @@ module.exports = (cmds, app, data, lando) => _.map(cmds, cmd => {
5973 } ;
6074 }
6175
62- // compute stdio based on compose major version
63- const cstdio = _ . get ( app , '_config.orchestratorMV' , 2 ) ? 'inherit' : [ 'inherit' , 'pipe' , 'pipe' ] ;
64-
65- // attempt to ascertain the SAPI
66- const sapi = _ . get ( app , 'v4.services' , [ ] ) . find ( s => s . id === service ) ?. api
67- ?? _ . get ( app , `sapis.${ service } ` , undefined )
68- ?? _ . get ( data , `sapis.${ service } ` , undefined ) ;
69-
70- // normalize cmd
71- cmd = getCommand ( cmd ) ;
72-
73- // if array then just join it together
74- if ( _ . isArray ( cmd ) ) cmd = cmd . join ( ' ' ) ;
75-
7676 // lando 4 services
7777 // @NOTE : lando 4 service events will change once we have a complete hook system
7878 if ( sapi === 4 ) {
0 commit comments