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

This commit is contained in:
Nathan Coad
2023-02-10 17:15:59 +11:00
parent e2b4dbca4e
commit bebeae7358
5 changed files with 88 additions and 318 deletions

View File

@@ -72,6 +72,14 @@ func init() {
"out-filename"
],
"properties": {
"files": {
"description": "File to create before running commands.",
"type": "array",
"default": null,
"items": {
"$ref": "#/definitions/direktivFile"
}
},
"in-data": {
"description": "json input to convert to spreadsheet",
"type": "object"
@@ -129,40 +137,16 @@ func init() {
"cmds": [
{
"action": "exec",
"exec": "ls -la",
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"input.json\" {{- else }} {{ .Infile }} {{- end }} -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "pwd",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "/bin/bash -c \"echo '{{ .InData | toJson }}' \u003e /tmp/input.json\"",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "find / -name '*.json'",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"/tmp/input.json\" {{- else }} {{ .Infile }} {{- end }} -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "base64 -w 0 /tmp/{{ .OutFilename }}"
"exec": "base64 -w 0 {{ .OutFilename }}"
}
],
"output": "{\n \"export-excel\": {{ (index . 5).result | toJson }}\n}\n"
"output": "{\n \"export-excel\": {{ (index . 1).result | toJson }}\n}\n"
},
"x-direktiv-errors": {
"io.direktiv.command.error": "Command execution failed",
@@ -171,7 +155,7 @@ func init() {
},
"x-direktiv-examples": [
{
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: /tmp/input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
"title": "Rely on Direktiv to create input file"
},
{
@@ -316,40 +300,16 @@ func init() {
"cmds": [
{
"action": "exec",
"exec": "ls -la",
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"input.json\" {{- else }} {{ .Infile }} {{- end }} -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "pwd",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "/bin/bash -c \"echo '{{ .InData | toJson }}' \u003e /tmp/input.json\"",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "find / -name '*.json'",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"/tmp/input.json\" {{- else }} {{ .Infile }} {{- end }} -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
"print": true,
"silent": false
},
{
"action": "exec",
"exec": "base64 -w 0 /tmp/{{ .OutFilename }}"
"exec": "base64 -w 0 {{ .OutFilename }}"
}
],
"output": "{\n \"export-excel\": {{ (index . 5).result | toJson }}\n}\n"
"output": "{\n \"export-excel\": {{ (index . 1).result | toJson }}\n}\n"
},
"x-direktiv-errors": {
"io.direktiv.command.error": "Command execution failed",
@@ -358,7 +318,7 @@ func init() {
},
"x-direktiv-examples": [
{
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: /tmp/input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
"content": "- id: export-xlsx\n type: action\n action:\n function: export-xlsx\n input: \n files:\n - name: input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
"title": "Rely on Direktiv to create input file"
},
{
@@ -436,6 +396,14 @@ func init() {
"out-filename"
],
"properties": {
"files": {
"description": "File to create before running commands.",
"type": "array",
"default": [],
"items": {
"$ref": "#/definitions/direktivFile"
}
},
"in-data": {
"description": "json input to convert to spreadsheet",
"type": "object"