Skip to content

Commit

Permalink
(fix) exec markdown spacing and flowfile defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jahvon committed Jul 17, 2024
1 parent c1c50d6 commit cadd643
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions internal/filesystem/executables.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func LoadWorkspaceFlowFiles(
logger.Errorx("unable to load executable config file", "configFile", cfgFile, "err", err)
continue
}
cfg.SetDefaults()
cfg.SetContext(workspaceCfg.AssignedName(), workspaceCfg.Location(), cfgFile)
cfgs = append(cfgs, cfg)
}
Expand Down
2 changes: 2 additions & 0 deletions tools/builder/flowfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func ExamplesMultiExecFlowFile(opts ...Option) *executable.FlowFile {
}
if len(opts) > 0 {
vals := NewOptionValues(opts...)
d.SetDefaults()
d.SetContext(vals.WorkspaceName, vals.WorkspacePath, vals.FlowFilePath)
}
return d
Expand All @@ -62,6 +63,7 @@ func ExamplesRequestExecFlowFile(opts ...Option) *executable.FlowFile {
}
if len(opts) > 0 {
vals := NewOptionValues(opts...)
d.SetDefaults()
d.SetContext(vals.WorkspaceName, vals.WorkspacePath, vals.FlowFilePath)
}
return d
Expand Down
11 changes: 7 additions & 4 deletions types/executable/executable_md.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,21 @@ func execMarkdown(e *Executable) string {
}

func execDescriptionMarkdown(e *Executable) string {
if e.Description == "" && e.inheritedDescription == "" {
return ""
}
var mkdwn string
const descSpacer = "| \n"
if e.Description != "" {
if d := strings.TrimSpace(e.Description); d != "" {
mkdwn += descSpacer
lines := strings.Split(e.Description, "\n")
lines := strings.Split(d, "\n")
for _, line := range lines {
mkdwn += fmt.Sprintf("| %s\n", line)
}
mkdwn += descSpacer
}
if e.inheritedDescription != "" {
for _, line := range strings.Split(e.inheritedDescription, "\n") {
if d := strings.TrimSpace(e.inheritedDescription); d != "" {
for _, line := range strings.Split(d, "\n") {
mkdwn += fmt.Sprintf("| %s\n", line)
}
mkdwn += descSpacer
Expand Down

0 comments on commit cadd643

Please sign in to comment.