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)
````
{
"body": "body",
"method": "POST",
"headers": {
"key": "value"
},
"queries": {
"key": "value"
},
"path": "string"
}
````
invocation-type 选填,默认 sync
event 选填event 函数默认为空字符串http 函数默认 GET 请求,其他参数为空

View File

@ -13,25 +13,25 @@ export default [
{
name: 'invocation-type',
description: 'Invocation type: optional value "async"|"sync", default value "sync" (default: "sync")',
alias: '-t',
alias: 't',
type: String,
},
{
name: 'event',
description: 'Event data (strings) passed to the function during invocation (default: "")',
alias: '-e',
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',
type: String,
},
{
name: 'event-file',
description: 'A file containing event data passed to the function during invoke.',
alias: '-f',
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',
type: String,
},
{
name: 'event-stdin',
description: 'Read from standard input, to support script pipeline.',
alias: '-s',
description: 'Read from standard input, to support script pipeline.Http function format refers to [https://github.com/devsapp/fc-remote-invoke#特别说明]',
alias: 's',
type: Boolean,
},
{
@ -65,13 +65,17 @@ export default [
{
header: 'Examples with Yaml',
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',
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 * as core from '@serverless-devs/core';
import logger from './common/logger';
import help from './common/help';
import HELP from './common/help';
import { InputProps, ICredentials, isProperties, IProperties } from './interface/entity';
import RemoteInvoke from './lib/remote-invoke';
@ -103,10 +103,11 @@ export default class FcRemoteInvoke {
isHelp,
invocationType,
} = await this.handlerInputs(inputs);
// await this.report('fc-remote-invoke', 'invoke', credentials?.AccountID);
await this.report('fc-remote-invoke', 'invoke', credentials?.AccountID);
if (isHelp) {
core.help(help)
console.log('??');
core.help(HELP);
return;
}