Skip to content

Commit 90942f7

Browse files
committed
Move format package from internal to public
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
1 parent ca8f833 commit 90942f7

File tree

248 files changed

+62
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+62
-17
lines changed

internal/format/asciidoc_document.go renamed to format/asciidoc_document.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewAsciidocDocument(settings *print.Settings) print.Engine {
3737
tt := template.New(settings, items...)
3838
tt.CustomFunc(gotemplate.FuncMap{
3939
"type": func(t string) string {
40-
result, extraline := printFencedAsciidocCodeBlock(t, "hcl")
40+
result, extraline := PrintFencedAsciidocCodeBlock(t, "hcl")
4141
if !extraline {
4242
result += "\n"
4343
}
@@ -47,7 +47,7 @@ func NewAsciidocDocument(settings *print.Settings) print.Engine {
4747
if v == "n/a" {
4848
return v
4949
}
50-
result, extraline := printFencedAsciidocCodeBlock(v, "json")
50+
result, extraline := PrintFencedAsciidocCodeBlock(v, "json")
5151
if !extraline {
5252
result += "\n"
5353
}

internal/format/asciidoc_table.go renamed to format/asciidoc_table.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ func NewAsciidocTable(settings *print.Settings) print.Engine {
3737
tt := template.New(settings, items...)
3838
tt.CustomFunc(gotemplate.FuncMap{
3939
"type": func(t string) string {
40-
inputType, _ := printFencedCodeBlock(t, "")
40+
inputType, _ := PrintFencedCodeBlock(t, "")
4141
return inputType
4242
},
4343
"value": func(v string) string {
4444
var result = "n/a"
4545
if v != "" {
46-
result, _ = printFencedCodeBlock(v, "")
46+
result, _ = PrintFencedCodeBlock(v, "")
4747
}
4848
return result
4949
},
File renamed without changes.

format/doc.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
Copyright 2021 The terraform-docs Authors.
3+
4+
Licensed under the MIT license (the "License"); you may not
5+
use this file except in compliance with the License.
6+
7+
You may obtain a copy of the License at the LICENSE file in
8+
the root directory of this source tree.
9+
*/
10+
11+
// Package format provides different, out of the box supported, output formats.
12+
//
13+
// Usage
14+
//
15+
// A specific format can be instantiated either for `format.Factory()` function or
16+
// directly calling its function (e.g. `NewMarkdownTable`, etc)
17+
//
18+
// formatter, err := format.Factory("markdown table", settings)
19+
// if err != nil {
20+
// return err
21+
// }
22+
//
23+
// generator, err := formatter.Generate(tfmodule)
24+
// if err != nil {
25+
// return err
26+
// }
27+
//
28+
// output, err := generator.ExecuteTemplate("")
29+
// if err != nil {
30+
// return err
31+
// }
32+
//
33+
// Supported formats are:
34+
//
35+
// • `NewAsciidocDocument`
36+
// • `NewAsciidocTable`
37+
// • `NewJSON`
38+
// • `NewMarkdownDocument`
39+
// • `NewMarkdownTable`
40+
// • `NewPretty`
41+
// • `NewTfvarsHCL`
42+
// • `NewTfvarsJSON`
43+
// • `NewTOML`
44+
// • `NewXML`
45+
// • `NewYAML`
46+
//
47+
package format
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)