Prevent cobra from overwriting files by default#68
Closed
larsks wants to merge 3 commits into
Closed
Conversation
The cmd/ tests compared generated output to static data stored in cmd/testdata. The static data included the year, so each year the static files must be updated or the test fails. This commit treats the "golden" files as a template and substitutes the year before making the comparison.
Running `cobra-cli init` or `cobra-cli add` would overwrite existing files without warning, which could result in unexpected loss of data. This commit modifies cobra-cli so that by default it will not overwrite files, and adds the `--force` flag to the `init` and `add` subcommands to allow it to overwrite files. Closes spf13#59
Refactor cmd/init_test.go so that we can sanely run multiple tests, and then add tests for the --force feature.
f3e1d42 to
20e98e4
Compare
Author
|
@spf13 (et al?) just checking to see if anyone is interested in this PR. Cheers! |
Author
|
Looks like that's a "no". |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running
cobra-cli initorcobra-cli addwould overwrite existing files without warning, which could result in unexpected loss of data. This commit modifies cobra-cli so that by default it will not overwrite files, and adds the--forceflag to theinitandaddsubcommands to allow it to overwrite files.Closes #59