Repository navigation
refactor: pin CLI output and rename path fields - #711
Merged
Merged
Conversation
The next refactor moves every command's entry code. These tests show that what a run prints and leaves behind stays the same.
A field named for a thing now holds the thing itself and Path means an absolute path, so a default location, a found user data dir and a relative path no longer share a name.
1 of 4 tasks
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.
Summary
Part of #710. Step 1 of 4: preparation only, no behavior change.
Tests that pin what a run prints, added before the refactor moves every command's entry code:
help.golden: the rendered-hof the root command and the six subcommands.errors.golden: thirteen failing invocations, each with its error line and whether the usage was printed.TestNothingFound: with no browser on the machine,dumpandarchivecreate nothing,listsays so, anddumpkeysprints a key file without vaults.Both goldens replace the OS's browser names with a placeholder, so one file serves every OS.
help.goldenrecords today's[=true|false]on bool flags as it is; fixing that will show up as a golden diff.Renames, with no logic change:
Platform.UserDataDirsPlatform.UserDataDirPathsSource.Path,Source.Paths()Source.RelativePath,Source.RelativePaths()snapshot.Temp()snapshot.NewRoot()app.Outputapp.OutputOptionsreport,announceExportin cmdprintSummary,printExporteddirofexport.NewWriter,checkOutputDir,zipfile.ExtractoutputDir,outputDir,targetDirThe two rules behind them are added to RFC-001: a field named for a thing holds the thing itself, and a path is absolute unless its name says it is relative.
Existing golden files are unchanged, and a full run with
HBD_UPDATE_GOLDEN=1rewrites none of them.Checklist
mainbranchgo 1.20(do not bump)