functionbuilder
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nathan Coad
2023-02-10 16:54:40 +11:00
parent bceb78033c
commit 178e27bc7e
4 changed files with 15 additions and 3 deletions

View File

@@ -19,6 +19,9 @@ import (
// swagger:model postParamsBody
type PostParamsBody struct {
// json input to convert to spreadsheet
InData interface{} `json:"in-data,omitempty"`
// Name of the json input file to utilise
Infile string `json:"infile,omitempty"`

View File

@@ -72,6 +72,10 @@ func init() {
"out-filename"
],
"properties": {
"in-data": {
"description": "json input to convert to spreadsheet",
"type": "object"
},
"infile": {
"description": "Name of the json input file to utilise",
"type": "string"
@@ -137,7 +141,7 @@ func init() {
},
{
"action": "exec",
"exec": "ls -la /tmp",
"exec": "/bin/bash -c \"echo '{{ .InData | toJson }}' \u003e /tmp/input.json\"",
"print": true,
"silent": false
},
@@ -320,7 +324,7 @@ func init() {
},
{
"action": "exec",
"exec": "ls -la /tmp",
"exec": "/bin/bash -c \"echo '{{ .InData | toJson }}' \u003e /tmp/input.json\"",
"print": true,
"silent": false
},
@@ -424,6 +428,10 @@ func init() {
"out-filename"
],
"properties": {
"in-data": {
"description": "json input to convert to spreadsheet",
"type": "object"
},
"infile": {
"description": "Name of the json input file to utilise",
"type": "string"

View File

@@ -366,7 +366,7 @@ func runCommand2(ctx context.Context,
params.DirektivDir,
}
cmd, err := templateString(`ls -la /tmp`, at)
cmd, err := templateString(`/bin/bash -c "echo '{{ .InData | toJson }}' > /tmp/input.json"`, at)
if err != nil {
ri.Logger().Infof("error executing command: %v", err)
ir[resultKey] = err.Error()

View File

@@ -101,6 +101,7 @@ functions:
| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| in-data | [interface{}](#interface)| `interface{}` | | | json input to convert to spreadsheet | |
| infile | string| `string` | | | Name of the json input file to utilise | |
| out-filename | string| `string` | ✓ | `"output.xlsx"`| the filename of the output spreadsheet | |
| worksheet-name | string| `string` | ✓ | `"Sheet1"`| Label for the worksheet created in the spreadsheet | |