Commit Graph

25 Commits

Author SHA1 Message Date
Khosrow Moossavi
90942f73b8 Move format package from internal to public
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-09-28 14:43:26 -04:00
Khosrow Moossavi
ca8f8333d4 Move template package from internal to public
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-09-28 14:18:05 -04:00
Poojitha Bikki
045707beee feat: Add new flag 'read-comments' to optionally process comments as description
fixes issue #552

- process description from comments

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- fix module tests

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- optionally read comments for output vars description

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- set default to true

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- run make docs

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- change option name

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- add option in doc generator; make docs

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- add config 'ReadComments'

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- Fix alphabetic order for 'ReadComments' setting

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- add read-comments in docs

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- add test for readcomments option

Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>

- update 'read-comments' flag description

Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
Signed-off-by: Poojitha Bikki <50849668+poojitha-bikki@users.noreply.github.com>
2021-09-24 18:04:39 -05:00
Khosrow Moossavi
f33826c5df Cleanup documentations
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-09-13 18:07:57 -04:00
Khosrow Moossavi
6777364257 Customize content with individual sections output
Generated content can be customized further away with `content` in configuration.
If the `content` is empty the default orders of section is used. `content` is a
Go template with following additional variables:

- `{{ .Header }}`
- `{{ .Footer }}`
- `{{ .Inputs }}`
- `{{ .Modules }}`
- `{{ .Outputs }}`
- `{{ .Providers }}`
- `{{ .Requirements }}`
- `{{ .Resources }}`

```yaml
content: |-
  Any arbitrary text can be placed anywhere in the content

  {{ .Header }}

  and even in between sections

  {{ .Providers }}

  and they don't even need to be in the default order

  {{ .Outputs }}

  {{ .Inputs }}
```

These variables are the generated output of individual sections in the selected
formatter. For example `{{ .Inputs }}` is Markdown Table representation of inputs
when formatter is set to `markdown table` and AsciiDoc Document representation
when formatter is set to `asciidoc document` and so on.

Compatible formats for customized content are:

- `asciidoc document`
- `asciidoc table`
- `markdown document`
- `markdown table`

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-05-12 16:12:38 -04:00
Khosrow Moossavi
3cc4f4416f Fix issues reported by golangci-lint
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-16 17:33:10 -04:00
Simon Clifford
aa1e6bbf59 Add support for footer docs
Enables a footer to be appended to the end of a generated document
sourced from tf files or documents in the same way as the header

Adds the `footer-from` field to the config yml
Adds the `--footer-from` flag to the cli

Signed-off-by: Simon Clifford <siclifford@gmail.com>
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-15 14:51:00 -04:00
Khosrow Moossavi
2b150c1876 Enable site deploy preview for pull requests
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-04 17:28:21 -05:00
Khosrow Moossavi
152928007f Update reference documentation and guide
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-01 16:42:59 -05:00
Khosrow Moossavi
8ade41399e Remove irrelevant sort information from Settings
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-02-28 20:37:12 -05:00
Khosrow Moossavi
304bce9bb0 Refactor docs to be published on website
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-02-23 17:28:12 -05:00
Khosrow Moossavi
89d7f6cf86 Move pkg/print to internal/print
Originally pkg/print was intended to be public to be used by plugin
developers, but this setting has to be defined by plugin-sdk and as such
it's moved to internal/format to be only used by terraform-docs core
project.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-02-02 18:19:58 -05:00
Khosrow Moossavi
44b3361b22 Add license header to codebase files
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-01-28 12:29:11 -05:00
Khosrow Moossavi
e3a19ea9dd Move pkg/tfconf to internal/terraform
Originally pkg/tfconf was set to be public to be used by plugin
developers, but these structs have to be defined by plugin-sdk and as
such it's moved to internal/terraform to be only used by terraform-docs
core project.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-01-26 15:39:30 -05:00
Khosrow Moossavi
63750c1784 fix: Normalize last empty line of the generated output (#336)
Generated output will not have any empty line or
carriage return at the end of the last line and
one carriage return (\n) will be added when we
print that to stdout.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-10-15 18:51:30 -04:00
Khosrow Moossavi
dfeaaecdc4 Migrate to github.com/terraform-docs org (#288)
* Migrate to github.com/terraform-docs org

* remove codecov token

* update maintenance notice in README
2020-07-06 19:43:25 -04:00
Khosrow Moossavi
04a9ef49eb refactor: Refactor cli implemention and configuration (#266)
* Refactor cli implemention and configuration

* cleanup
2020-05-20 22:21:19 -04:00
Khosrow Moossavi
c196c7cc49 refactor: Add factory function to return format types (#243) 2020-04-10 19:08:37 -04:00
Khosrow Moossavi
40bd96be44 docs: Enhance automatic document generation (#227)
* Enhance automatic document generation

* update contribuor guide

* fix broken link
2020-03-29 18:17:55 -04:00
Khosrow Moossavi
9043f268ad feat: Add support for tfvars hcl and json commands (#226)
* Add support for tfvars hcl and json commands

* fix docs generation header issue

* align padding of hcl tfvars items

* add more tests

* update docs

* wording
2020-03-27 15:02:09 -04:00
Khosrow Moossavi
01c8fa1c61 feat: Add support for fetching the module header from any file (#217)
* Add support for fetching the module header from any file

* fix the failing test because of lines reader
2020-03-12 13:58:35 -04:00
Khosrow Moossavi
b716a25811 feat: Add support for XML renderer (#198)
* Add support for XML renderer

* formatting

* update docs
2020-02-26 14:44:50 -05:00
Khosrow Moossavi
38e18970ed refactor: Introduce Format interface and expose to public pkg (#195)
* Introduce format interface and expose to public pkg

* fix issues after merge

* don't panic

* Rename TFString back to String
2020-02-19 14:07:10 -05:00
Khosrow Moossavi
d4a0663909 refactor: Add tfconf.Options to load Module with (#193) 2020-02-11 14:56:02 -05:00
Khosrow Moossavi
54ab7f9bbb docs: Auto generate formats document from examples (#192)
* Auto generate formats document from examples

* fix lint issues
2020-02-10 20:53:57 -05:00