-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) read flowfile and ws description from file (#140)
- Loading branch information
Showing
18 changed files
with
164 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/jahvon/flow/HEAD/schemas/workspace_schema.json | ||
displayName: flow | ||
git: | ||
enabled: false | ||
displayName: flow repository | ||
descriptionFile: README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package workspace | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
func workspaceMarkdown(w *Workspace) string { | ||
var mkdwn string | ||
if w.DisplayName != "" { | ||
mkdwn = fmt.Sprintf("# [Workspace] %s\n", w.DisplayName) | ||
} else { | ||
mkdwn = fmt.Sprintf("# [Workspace] %s\n", w.AssignedName()) | ||
} | ||
mkdwn += workspaceDescription(w) | ||
if len(w.Tags) > 0 { | ||
mkdwn += "**Tags**\n" | ||
for _, tag := range w.Tags { | ||
mkdwn += fmt.Sprintf("- %s\n", tag) | ||
} | ||
} | ||
if w.Executables != nil { | ||
mkdwn += "**Executable Filter**\n" | ||
if len(w.Executables.Included) > 0 { | ||
mkdwn += "Included\n" | ||
for _, line := range w.Executables.Included { | ||
mkdwn += fmt.Sprintf(" %s\n", line) | ||
} | ||
} | ||
if len(w.Executables.Excluded) > 0 { | ||
mkdwn += "Excluded\n" | ||
for _, line := range w.Executables.Excluded { | ||
mkdwn += fmt.Sprintf(" %s\n", line) | ||
} | ||
} | ||
} | ||
mkdwn += fmt.Sprintf("\n\n_Workspace can be found in_ [%s](%s)\n", w.Location(), w.Location()) | ||
return mkdwn | ||
} | ||
|
||
func workspaceDescription(w *Workspace) string { | ||
var mkdwn string | ||
const descSpacer = "| \n" | ||
if w.Description != "" { | ||
mkdwn += descSpacer | ||
lines := strings.Split(w.Description, "\n") | ||
for _, line := range lines { | ||
mkdwn += fmt.Sprintf("| %s\n", line) | ||
} | ||
mkdwn += descSpacer | ||
} | ||
if w.DescriptionFile != "" { | ||
mdBytes, err := os.ReadFile(filepath.Clean(w.DescriptionFile)) | ||
if err != nil { | ||
mkdwn += fmt.Sprintf("| **error rendering description file**: %s\n", err) | ||
} else { | ||
lines := strings.Split(string(mdBytes), "\n") | ||
for _, line := range lines { | ||
mkdwn += fmt.Sprintf("| %s\n", line) | ||
} | ||
} | ||
mkdwn += descSpacer | ||
} | ||
mkdwn += "\n" | ||
return mkdwn | ||
} |