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.
This fixes a couple of issues but we should have some follow up work planned for a more robust fix.
I found that the cobra search command will return the parent command if it can't find an appropriate child, at least in the case of
state --version
it will strip the flag and return the parent command if there are no more arguments.Since we want to run the autoupdate check for
state --version
we have to update the handling inmain.go
. In going through this I found that we have 3 separate checks for "Should we run autoupdate". These should be centralized however I didn't address this for the bug fix as this is targeting an RC4 that we would like to release soon.Lastly, we check the modification time of the installed binary and will not run the autoupdate if the file is less than 24 hours old. I did not modify that as part of this PR but I can if we no longer desire that behaviour.