diff --git a/pkg/config/config.go b/pkg/config/config.go index 6d81ffb..d881adf 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -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 { diff --git a/pkg/drawtable/csv2table.go b/pkg/drawtable/csv2table.go index a77c99c..354f3b8 100644 --- a/pkg/drawtable/csv2table.go +++ b/pkg/drawtable/csv2table.go @@ -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") } diff --git a/tests/config.yaml b/tests/config.yaml index b237b29..f68aa10 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -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 diff --git a/tests/example.csv b/tests/example.csv new file mode 100644 index 0000000..d02112c --- /dev/null +++ b/tests/example.csv @@ -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","","","","",""