Merge pull request #2 from devsapp/fix/help

fix: help
This commit is contained in:
wss-git 2021-06-09 18:51:30 +08:00 committed by GitHub
commit 748a524669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}