Skip to content

Commit

Permalink
rendering options
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Jadhav <[email protected]>
  • Loading branch information
nyrahul committed Jun 30, 2023
1 parent ac72d5b commit 42ff114
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type TableConfig struct {
Caption string `yaml:"caption"`
Markdown string `yaml:"markdown"`
Html string `yaml:"html"`
Nostdout bool `yaml:"nostdout"`
}

type Paint struct {
Expand Down
4 changes: 3 additions & 1 deletion pkg/drawtable/csv2table.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ func Csv2Table(cfg config.Config) {
return nil
})
t.SetStyle(table.StyleLight)
t.Render()
if !cfg.YamlCfg.Table.Nostdout {
t.Render()
}
write2file(t, cfg.YamlCfg.Table.Markdown, "md")
write2file(t, cfg.YamlCfg.Table.Html, "html")
}
5 changes: 5 additions & 0 deletions tests/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# default | left | center | justify | right
# ref: https://github.com/jedib0t/go-pretty/blob/main/text/align.go#L11
#
# table:
# title: "Title"
# markdown: /tmp/markdown.md
# html: /tmp/html.html
# nostdout: true # Disable rendering table to stdout
# columns:
# - name: XYZ
# maxwidth: 10
Expand Down
13 changes: 13 additions & 0 deletions tests/example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Name,Address,Status,Version,Ciphersuite,Hash,Signature,Verification
"Google","google.com:443","TLS","TLSv1.3","TLS_AES_256_GCM_SHA384","SHA256","ECDSA","OK"
"Accuknox","accuknox.com:443","TLS","TLSv1.3","TLS_AES_256_GCM_SHA384","SHA256","RSA-PSS","OK"
"BadSSL","expired.badssl.com:443","TLS","TLSv1.2","ECDHE-RSA-AES128-GCM-SHA256","SHA512","RSA","certificate has expired"
"BadSSL","wrong.host.badssl.com:443","TLS","TLSv1.2","ECDHE-RSA-AES128-GCM-SHA256","SHA512","RSA","OK"
"BadSSL","self-signed.badssl.com:443","TLS","TLSv1.2","ECDHE-RSA-AES128-GCM-SHA256","SHA512","RSA","self-signed certificate"
"BadSSL","untrusted-root.badssl.com:443","TLS","TLSv1.2","ECDHE-RSA-AES128-GCM-SHA256","SHA512","RSA","self-signed certificate in certificate chain"
"BadSSL","revoked.badssl.com:443","TLS","TLSv1.2","ECDHE-RSA-AES128-GCM-SHA256","SHA512","RSA","certificate has expired"
"BadSSL","pinning-test.badssl.com:443","TLS","TLSv1.2","ECDHE-RSA-AES128-GCM-SHA256","SHA512","RSA","OK"
"BadSSL","dh480.badssl.com:443","PLAIN_TEXT","","","","",""
"LocalTest","isunknownaddress.com:12345","CONNFAIL","","","","",""
"localhost:9090","localhost:9090","CONNFAIL","","","","",""
"namespace:deployment/wordpress","localhost:22","PLAIN_TEXT","","","","",""

0 comments on commit 42ff114

Please sign in to comment.