Closed
Labels
area: cliFlags, exit codes, main.goFlags, exit codes, main.goenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
What
parseInterspersed and endsWithTerminator exist twice: in main.go and, since #133, in tools/wordlist-gen.go. Both are package main, so they could not import each other.
How
- Move the two functions into a small package, for example
internal/cliargs, ascliargs.Parse(fs *flag.FlagSet, args []string) ([]string, error). - Use it from both programs and delete the copies.
- Move or add the tests for flags after positionals and the
--terminator (seemain_test.goandtools/wordlist-gen_test.go).
Done when
One implementation, used by both programs, with its own tests; go test ./... passes.
Metadata
Metadata
Assignees
Labels
area: cliFlags, exit codes, main.goFlags, exit codes, main.goenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Activity
TMHSDigital commentedon Nov 10, 2026
Fixed in d6d4954: the two identical copies of
parseInterspersed/endsWithTerminatorinmain.goandtools/wordlist-gen.goare now onecliargs.Parseininternal/cliargs(moved verbatim, so behaviour is unchanged). Verified with the existingTestParseFlagsInterspersed/TestParseFlagsInvalidAfterDomainand wordlist-gen terminator tests, new table tests ininternal/cliargs(96% coverage), a newTestRunInterspersedFlagsfor wordlist-gen, and the fullgo test -race ./....refactor(cli): share the interspersed flag parser via internal/cliargs (