Skip to content

Add new flag to sort inputs by type #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 13, 2020

Conversation

khos2ow
Copy link
Member

@khos2ow khos2ow commented Apr 13, 2020

Prerequisites

Put an x into the box(es) that apply:

  • This pull request fixes a bug.
  • This pull request adds a feature.
  • This pull request enhances existing functionality.
  • This pull request introduces breaking change.

For more information, see the Contributing Guide.

Description

This PR adds a new flag --sort-by-type which sorts the input based on their type, alphabetically. Available types are:

  • any
  • bool
  • list
  • map
  • object
  • string

For example the following inputs are sorted by types as:

Name Description Type Default
unquoted n/a any n/a
bool-1 It's bool number one. bool true
bool-2 It's bool number two. bool false
list-1 It's list number one. list
[
"a",
"b",
"c"
]
list-2 It's list number two. list n/a
map-1 It's map number one. map
{
"a": 1,
"b": 2,
"c": 3
}
map-2 It's map number two. map n/a
number-1 It's number number one. number 42
number-2 It's number number two. number n/a
object_default_empty n/a object({}) {}
string-1 It's string number one. string "bar"
string-2 It's string number two. string n/a

Issues Resolved

List any existing issues this pull request resolves.

Checklist

Put an x into all boxes that apply:

Tests

  • I have added tests to cover my changes.
  • All tests pass when I run make test.

Documentation

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Code Style

  • My code follows the code style of this project.

@codecov-io
Copy link

codecov-io commented Apr 13, 2020

Codecov Report

Merging #246 into master will increase coverage by 0.10%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #246      +/-   ##
==========================================
+ Coverage   81.27%   81.38%   +0.10%     
==========================================
  Files          33       33              
  Lines        1736     1746      +10     
==========================================
+ Hits         1411     1421      +10     
  Misses        272      272              
  Partials       53       53              
Impacted Files Coverage Δ
internal/module/input.go 100.00% <100.00%> (ø)
internal/module/module.go 91.03% <100.00%> (+0.17%) ⬆️
internal/module/options.go 80.00% <100.00%> (ø)

@khos2ow khos2ow merged commit b25909b into terraform-docs:master Apr 13, 2020
@khos2ow khos2ow deleted the sort-by-type branch April 13, 2020 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants