fix: handle comma-separated entries in -l/-list and stdin input #899
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.
Proposed Changes
Fixes #859
Problem
The
-l/-listfile input and stdin treat each line as a single target, not splitting on commas like the-uoption does. This causes comma-separated entries (e.g.192.168.1.0/24,192.168.2.0/24) to fail withno address found for hosterrors because the entire comma-separated string is treated as a single hostname.Solution
Add comma-splitting logic in
processInputItemso it applies uniformly to all input sources in a single place. When input contains a comma, it is split, trimmed, and each non-empty item is processed individually via recursive call.This approach differs from previous attempts that duplicated the split logic at each call site (file reader and stdin reader). By handling it in
processInputItem, the fix is DRY and automatically covers any future input sources.Changes
processInputItemininternal/runner/runner.goto detect and split comma-separated entriesTest_InputCommaSeparated_processInputItem— comma-separated domainsTest_InputCommaSeparatedCIDR_processInputItem— comma-separated CIDRsTest_InputListCommaSeparated_normalizeAndQueueInputs— comma-separated entries from file inputProof
Before (single line fails):
After (both hosts processed separately):
Checklist