-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to load style config from file (#92)
- Loading branch information
Showing
10 changed files
with
215 additions
and
4 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
7 changes: 7 additions & 0 deletions
7
printer/testdata/TestPrinterStyleFileOptions/Print_custom_layout.golden.txt
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,7 @@ | ||
-> fixed-name | ||
|
||
Version (devel) | ||
Dirty Build no | ||
Go version 1.19.4 | ||
Compiler gc | ||
Platform fixed-platform |
10 changes: 10 additions & 0 deletions
10
printer/testdata/TestPrinterStyleFileOptions/Print_default_layout.golden.txt
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,10 @@ | ||
▓▓▓ fixed-name | ||
|
||
Version (devel) | ||
Git Commit N/A | ||
Build Date N/A | ||
Commit Date N/A | ||
Dirty Build no | ||
Go version 1.19.4 | ||
Compiler gc | ||
Platform fixed-platform |
28 changes: 28 additions & 0 deletions
28
printer/testdata/TestPrinterStyleFileOptions/customStyle.json
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,28 @@ | ||
{ | ||
"formatting": { | ||
"header": { | ||
"prefix": "-> ", | ||
"color": "Magenta", | ||
"background": "", | ||
"options": null | ||
}, | ||
"key": { | ||
"color": "Yellow", | ||
"background": "", | ||
"options": [ | ||
"Bold" | ||
] | ||
}, | ||
"val": { | ||
"color": "Green", | ||
"background": "", | ||
"options": null | ||
}, | ||
"date": { | ||
"enableHumanizedSuffix": false | ||
} | ||
}, | ||
"layout": { | ||
"goTemplate": "{{ AdjustKeyWidth .ExtraFields }}\n{{ Header .Meta.CLIName }}\n\n {{ Key \"Version\" }} {{ .Version | Val }}\n {{ Key \"Dirty Build\" }} {{ .DirtyBuild | FmtBool | Val }}\n {{ Key \"Go version\" }} {{ .GoVersion | trimPrefix \"go\"| Val }}\n {{ Key \"Compiler\" }} {{ .Compiler | Val }}\n {{ Key \"Platform\" }} {{ .Platform | Val }}\n {{- range $item := (.ExtraFields | Extra) }}\n {{ $item.Key | Key }} {{ $item.Value | Val }}\n {{- end}}\n" | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
printer/testdata/TestPrinterStyleFileOptions/customStyle.yaml
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,31 @@ | ||
formatting: | ||
header: | ||
prefix: '-> ' | ||
color: Magenta | ||
background: "" | ||
options: [] | ||
key: | ||
color: Yellow | ||
background: "" | ||
options: | ||
- Bold | ||
val: | ||
color: Green | ||
background: "" | ||
options: [] | ||
date: | ||
enableHumanizedSuffix: true | ||
|
||
layout: | ||
goTemplate: | | ||
{{ AdjustKeyWidth .ExtraFields }} | ||
{{ Header .Meta.CLIName }} | ||
{{ Key "Version" }} {{ .Version | Val }} | ||
{{ Key "Dirty Build" }} {{ .DirtyBuild | FmtBool | Val }} | ||
{{ Key "Go version" }} {{ .GoVersion | trimPrefix "go"| Val }} | ||
{{ Key "Compiler" }} {{ .Compiler | Val }} | ||
{{ Key "Platform" }} {{ .Platform | Val }} | ||
{{- range $item := (.ExtraFields | Extra) }} | ||
{{ $item.Key | Key }} {{ $item.Value | Val }} | ||
{{- end}} |
10 changes: 10 additions & 0 deletions
10
printer/testdata/TestPrinterStyleFileOptions/invalidStyle.json
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,10 @@ | ||
{ | ||
"format": { | ||
"header": { | ||
"prefix": "-> ", | ||
"color": "Magenta", | ||
"background": "", | ||
"options": null | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
printer/testdata/TestPrinterStyleFileOptions/invalidStyle.yaml
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,6 @@ | ||
format: | ||
header: | ||
prefix: '-> ' | ||
color: Magenta | ||
background: "" | ||
options: [] |
10 changes: 10 additions & 0 deletions
10
printer/testdata/TestPrinterStyleFromEnvOptionsUseDefaults.golden.txt
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,10 @@ | ||
▓▓▓ fixed-name | ||
|
||
Version (devel) | ||
Git Commit N/A | ||
Build Date N/A | ||
Commit Date N/A | ||
Dirty Build no | ||
Go version 1.19.4 | ||
Compiler gc | ||
Platform fixed-platform |