Repository navigation
Conversation
-w is now a repeatable flag. The files are read in order and their lines concatenated before Prepare, so an entry in more than one list is scanned once. '-' stays valid as one entry (once). A config-file or SUBENUM_W value is a default that the command line replaces rather than extends. Closes TMHSDigital#199 Signed-off-by: nova-loop <[email protected]>
TMHSDigital
pushed a commit
that referenced
this pull request
Nov 10, 2026
-w is now a repeatable flag.Value. The files are read in order and their lines concatenated before wordlist.Prepare, so an entry found in more than one list is scanned once and counted as a duplicate. "-" stays valid as one entry (at most once, and not together with -dL -). A config-file or SUBENUM_W value is a default that the first -w on the command line replaces, keeping flag > env > config precedence. Resume fingerprints every -w file. Squash of #211, rebased onto main (CHANGELOG conflict with #196 resolved). Fixes #199 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LpkeXSPwrzd7ZCuX3no7gD
Owner
|
Thanks, this is a clean change, and the config/env replace-not-extend handling plus the stdin edge cases are well thought through.
|
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.
Description
-wcan now be repeated, so you can layer a general list and a target-specific one without concatenating them by hand:-wis aflag.Valueslice (wordlistPathsinmain_wordlist.go).readWordlistreads each file in order and concatenates the lines beforewordlist.Prepare, so an entry that appears in more than one list is scanned once and counted induplicates, the same way as within one file.-(stdin) stays valid as one of the entries. Two-entries are rejected ("standard input can only be read once"), and so is-w -together with-dL -, as before.SUBENUM_W: these still take a single path. Each is a default, so the next source replaces it rather than adding to it: env replaces config, and the first-won the command line replaces both. This keeps the existing flag > env > config precedence. OtherwiseSUBENUM_W=a.txt subenum -w b.txtwould silently scan both lists. This works through a smallmarkDefault()hook thatdefaultsLoader.applycalls after setting a value.inputDigestsfingerprints every-wfile, and runs that read stdin through any-w -still don't save resume state.Wordlist:and the "no valid entries" error list all the paths.docs/_includes/flags.md(-w <file>, usage text), a one-line note indocs/ARCHITECTURE.md, and a CHANGELOG entry under Unreleased / Added. Shell completions and the man page are generated from the FlagSet, so they pick up the new usage text, and-wwas already infileFlags.Related Issue
Closes #199
Type of Change
A single
-wbehaves exactly as before. In-hthe flag now shows as-w fileinstead of-w string.Checklist
main_wordlist_test.go):-w a -w bend to end with an overlapping entry scanned once, a file plus-from stdin, rejected inputs (two-,-w -with-dL -, one missing file), config/env/flag replacement, and flag parsing across the domain argumentgo test ./... -shuffle=on,go vet ./...,gofmt)I didn't run
make lintbecause golangci-lint isn't installed in my environment, so CI's lint job covers that.Ethical Considerations
Additional Information
The config file still accepts only a string for
w. I didn't addwtolistFlags, because those values are joined with commas and a path can contain a comma. If you'd like config-file lists of wordlists, that could be a follow-up with its own separator rule.AI assistance: This change was prepared with AI assistance. An AI coding assistant wrote the code, tests and doc updates from the issue. Before opening the PR I reviewed the diff and ran the checks listed above.