fix: help

This commit is contained in:
wss-git 2021-06-09 18:35:00 +08:00
parent 2b7c19294d
commit c23ba897f0
3 changed files with 31 additions and 12 deletions

View File

@ -40,5 +40,19 @@ $ s cli fc-remote-invoke invoke --region * --service-name * --function-name * --
当函数是 http 函数时event最终获取值目前仅支持 json 字符串,[示例参考](https://github.com/devsapp/fc-remote-invoke/blob/master/example/http.json) 当函数是 http 函数时event最终获取值目前仅支持 json 字符串,[示例参考](https://github.com/devsapp/fc-remote-invoke/blob/master/example/http.json)
````
{
"body": "body",
"method": "POST",
"headers": {
"key": "value"
},
"queries": {
"key": "value"
},
"path": "string"
}
````
invocation-type 选填,默认 sync invocation-type 选填,默认 sync
event 选填event 函数默认为空字符串http 函数默认 GET 请求,其他参数为空 event 选填event 函数默认为空字符串http 函数默认 GET 请求,其他参数为空

View File

@ -13,25 +13,25 @@ export default [
{ {
name: 'invocation-type', name: 'invocation-type',
description: 'Invocation type: optional value "async"|"sync", default value "sync" (default: "sync")', description: 'Invocation type: optional value "async"|"sync", default value "sync" (default: "sync")',
alias: '-t', alias: 't',
type: String, type: String,
}, },
{ {
name: 'event', name: 'event',
description: 'Event data (strings) passed to the function during invocation (default: "")', description: 'Event data (strings) passed to the function during invocation (default: "").Http function format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
alias: '-e', alias: 'e',
type: String, type: String,
}, },
{ {
name: 'event-file', name: 'event-file',
description: 'A file containing event data passed to the function during invoke.', description: 'Event funtion: A file containing event data passed to the function during invoke. Http function: A file containing http request options sent to http trigger. Format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
alias: '-f', alias: 'f',
type: String, type: String,
}, },
{ {
name: 'event-stdin', name: 'event-stdin',
description: 'Read from standard input, to support script pipeline.', description: 'Read from standard input, to support script pipeline.Http function format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
alias: '-s', alias: 's',
type: Boolean, type: Boolean,
}, },
{ {
@ -65,13 +65,17 @@ export default [
{ {
header: 'Examples with Yaml', header: 'Examples with Yaml',
content: [ content: [
'$ s exec -- invoke <options>', '$ s exec -- invoke --invocation-type sync --event [payload]',
'$ s exec -- invoke --invocation-type async --event-file [path]',
'$ s exec -- invoke --event-stdin',
], ],
}, },
{ {
header: 'Examples with Cli', header: 'Examples with Cli',
content: [ content: [
'$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * <options>', '$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * --event [payload]',
'$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * --event-file [path]',
'$ s cli fc-remote-invoke invoke --region * --service-name * --function-name * --event-stdin',
], ],
}, },
] ]

View File

@ -1,7 +1,7 @@
import _ from 'lodash'; import _ from 'lodash';
import * as core from '@serverless-devs/core'; import * as core from '@serverless-devs/core';
import logger from './common/logger'; import logger from './common/logger';
import help from './common/help'; import HELP from './common/help';
import { InputProps, ICredentials, isProperties, IProperties } from './interface/entity'; import { InputProps, ICredentials, isProperties, IProperties } from './interface/entity';
import RemoteInvoke from './lib/remote-invoke'; import RemoteInvoke from './lib/remote-invoke';
@ -103,10 +103,11 @@ export default class FcRemoteInvoke {
isHelp, isHelp,
invocationType, invocationType,
} = await this.handlerInputs(inputs); } = await this.handlerInputs(inputs);
// await this.report('fc-remote-invoke', 'invoke', credentials?.AccountID); await this.report('fc-remote-invoke', 'invoke', credentials?.AccountID);
if (isHelp) { if (isHelp) {
core.help(help) console.log('??');
core.help(HELP);
return; return;
} }