@@ -60,7 +60,9 @@ class __nomethod__Command extends Command {
6060 d : 'Specify debug mode (prints Gateway logs locally, response logs remotely)' ,
6161 t : 'Specify an Identity Token to use manually' ,
6262 x : 'Unauthenticated - Execute without a token (overrides active token and -t flag)' ,
63- i : 'Specify information mode (prints tar packing and execution request progress)'
63+ i : 'Specify information mode (prints tar packing and execution request progress)' ,
64+ h : 'Specify headers in format key1 value1 key2 value2 ...' ,
65+ a : 'Specify header "Authorization: Bearer [token]" token'
6466 } ,
6567 vflags : {
6668 '*' : 'all verbose flags converted to named keyword parameters'
@@ -198,6 +200,22 @@ class __nomethod__Command extends Command {
198200 let key = keys [ i ] ;
199201 kwargs [ key ] = await parseFileFromArg ( params . vflags [ key ] . join ( ' ' ) , infoMode ) ;
200202 }
203+ if ( params . flags . a ) {
204+ kwargs [ '__headers' ] = kwargs [ '__headers' ] || { } ;
205+ kwargs [ '__headers' ] [ 'Authorization' ] = `Bearer ${ params . flags . a . join ( ' ' ) } ` ;
206+ }
207+ if ( params . flags . h ) {
208+ let headerPairs = params . flags . h ;
209+ while ( headerPairs . length ) {
210+ kwargs [ '__headers' ] = kwargs [ '__headers' ] || { } ;
211+ let key = ( headerPairs . shift ( ) || '' )
212+ . split ( '-' )
213+ . map ( str => str [ 0 ] . toUpperCase ( ) + str . slice ( 1 ) )
214+ . join ( '-' ) ;
215+ let value = headerPairs . shift ( ) || '' ;
216+ kwargs [ '__headers' ] [ key ] = value ;
217+ }
218+ }
201219 } ;
202220
203221 kwargsCheck ( ) . catch ( e => callback ( e ) ) . then ( ( ) => {
0 commit comments