This commit is contained in:
@@ -17,6 +17,9 @@ import (
|
||||
// swagger:model postParamsBody
|
||||
type PostParamsBody struct {
|
||||
|
||||
// Name of the json input file to utilise
|
||||
Infile string `json:"infile,omitempty"`
|
||||
|
||||
// the filename of the output spreadsheet
|
||||
OutFilename *string `json:"out-filename,omitempty"`
|
||||
|
||||
|
@@ -68,6 +68,10 @@ func init() {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
},
|
||||
"out-filename": {
|
||||
"description": "the filename of the output spreadsheet",
|
||||
"type": "string",
|
||||
@@ -117,7 +121,7 @@ func init() {
|
||||
"cmds": [
|
||||
{
|
||||
"action": "exec",
|
||||
"exec": "/bin/json2excel -inputJson input.json -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"/tmp/input.json\" {{- else }} {{ .Infile }} {{- end }} input.json -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"print": true,
|
||||
"silent": false
|
||||
},
|
||||
@@ -135,7 +139,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: 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: /tmp/input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
||||
"title": "Basic"
|
||||
}
|
||||
],
|
||||
@@ -276,7 +280,7 @@ func init() {
|
||||
"cmds": [
|
||||
{
|
||||
"action": "exec",
|
||||
"exec": "/bin/json2excel -inputJson input.json -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"exec": "/bin/json2excel -inputJson {{- if eq (deref .Infile) \"\" }} \"/tmp/input.json\" {{- else }} {{ .Infile }} {{- end }} input.json -worksheetName \"{{ .WorksheetName }}\" -outputFilename '{{ .OutFilename }}'",
|
||||
"print": true,
|
||||
"silent": false
|
||||
},
|
||||
@@ -294,7 +298,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: 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: /tmp/input.json\n data: |\n jq(.input) \n worksheet-name: \"TestSpreadsheet\"\n out-filename: example.xlsx",
|
||||
"title": "Basic"
|
||||
}
|
||||
],
|
||||
@@ -364,6 +368,10 @@ func init() {
|
||||
"postParamsBody": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"infile": {
|
||||
"description": "Name of the json input file to utilise",
|
||||
"type": "string"
|
||||
},
|
||||
"out-filename": {
|
||||
"description": "the filename of the output spreadsheet",
|
||||
"type": "string",
|
||||
|
@@ -176,7 +176,7 @@ func runCommand0(ctx context.Context,
|
||||
params.DirektivDir,
|
||||
}
|
||||
|
||||
cmd, err := templateString(`/bin/json2excel -inputJson input.json -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}'`, at)
|
||||
cmd, err := templateString(`/bin/json2excel -inputJson {{- if eq (deref .Infile) "" }} "/tmp/input.json" {{- else }} {{ .Infile }} {{- end }} input.json -worksheetName "{{ .WorksheetName }}" -outputFilename '{{ .OutFilename }}'`, at)
|
||||
if err != nil {
|
||||
ri.Logger().Infof("error executing command: %v", err)
|
||||
ir[resultKey] = err.Error()
|
||||
|
Reference in New Issue
Block a user