-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In output-mode inject do not fail if file not found
The following scenarios can happen for --output-mode inject: - file exists, comments exist: inject output between comments - file exists, comments not found: append output at the end of file - file exists, but empty: save the whole output into the file - file not found: create the target file and save the ooutput into it Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
- Loading branch information
Showing
7 changed files
with
173 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit | ||
<!-- END_TF_DOCS --> |
22 changes: 22 additions & 0 deletions
22
internal/cli/testdata/writer/mode-inject-no-comment.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Foo | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
|
||
## Bar | ||
|
||
sed do eiusmod tempor incididunt ut labore et dolore magna | ||
aliqua. | ||
|
||
- Ut enim ad minim veniam | ||
- quis nostrud exercitation | ||
|
||
ullamco laboris nisi ut aliquip ex ea commodo consequat. | ||
Duis aute irure dolor in reprehenderit in voluptate velit | ||
|
||
## Baz | ||
|
||
esse cillum dolore eu fugiat nulla pariatur. | ||
|
||
<!-- BEGIN_TF_DOCS --> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Foo | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
|
||
## Bar | ||
|
||
sed do eiusmod tempor incididunt ut labore et dolore magna | ||
aliqua. | ||
|
||
- Ut enim ad minim veniam | ||
- quis nostrud exercitation | ||
|
||
ullamco laboris nisi ut aliquip ex ea commodo consequat. | ||
Duis aute irure dolor in reprehenderit in voluptate velit | ||
|
||
## Baz | ||
|
||
esse cillum dolore eu fugiat nulla pariatur. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters