@@ -108,6 +108,18 @@ async function handler(broker, args) {
108
108
}
109
109
}
110
110
111
+ // Remove non-standard call opts
112
+ [ {
113
+ key : "local" ,
114
+ replaceKey : "nodeID" ,
115
+ value : args . nodeID ,
116
+ } ] . forEach ( opt => {
117
+ if ( callOpts [ opt . key ] ) {
118
+ delete callOpts [ opt . key ] ;
119
+ opt . replaceKey ? callOpts [ opt . replaceKey ] = opt . value : undefined ;
120
+ }
121
+ } ) ;
122
+
111
123
const startTime = process . hrtime ( ) ;
112
124
const nodeID = args . nodeID ;
113
125
meta . $repl = true ;
@@ -123,8 +135,8 @@ async function handler(broker, args) {
123
135
isStream ( payload ) ? "" : payload ,
124
136
meta ? kleur . yellow ( ) . bold ( "with meta:" ) : "" ,
125
137
meta ? meta : "" ,
126
- callOpts ? kleur . yellow ( ) . bold ( "with options:" ) : "" ,
127
- callOpts ? callOpts : ""
138
+ Object . keys ( callOpts ) . length ? kleur . yellow ( ) . bold ( "with options:" ) : "" ,
139
+ Object . keys ( callOpts ) . length ? callOpts : ""
128
140
) ;
129
141
130
142
try {
@@ -209,6 +221,7 @@ function declaration(program, broker, cmdHandler) {
209
221
"--loadFull [filename]" ,
210
222
'Load params and meta from file (e.g., {"params":{}, "meta":{}, "options":{}})'
211
223
)
224
+ . option ( "--$local" , "Call the local service broker" )
212
225
. option ( "--stream [filename]" , "Send a file as stream" )
213
226
. option ( "--save [filename]" , "Save response to file" )
214
227
. allowUnknownOption ( true )
@@ -228,6 +241,7 @@ function declaration(program, broker, cmdHandler) {
228
241
thisCommand . params = {
229
242
options : parsedArgs ,
230
243
actionName,
244
+ nodeID : parsedArgs . $local ? broker . nodeID : undefined ,
231
245
...( jsonParams !== undefined ? { jsonParams } : undefined ) ,
232
246
rawCommand,
233
247
} ;
0 commit comments