Skip to content

Commit 44fd2e7

Browse files
committed
Fix -l/-list option to parse comma-separated values
This commit fixes issue #859 where the -l/-list option did not handle comma-separated values on a single line, unlike the -u option which correctly parses comma-separated hosts. Changes: - Modified normalizeAndQueueInputs() to split file input lines by comma - Applied same logic to stdin input for consistency - Each item is trimmed of whitespace before processing - Maintains backward compatibility with newline-separated inputs Now both -u and -l options support the same comma-separated format: ./tlsx -u host1,host2,host3 ./tlsx -l file.txt (where file.txt contains: host1,host2,host3) Fixes #859
1 parent d13b67f commit 44fd2e7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

internal/runner/runner.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,13 @@ func (r *Runner) normalizeAndQueueInputs(inputs chan taskInput) error {
440440
for scanner.Scan() {
441441
text := scanner.Text()
442442
if text != "" {
443-
r.processInputItem(text, inputs)
443+
// Split by comma to support comma-separated values in a single line
444+
for _, item := range strings.Split(text, ",") {
445+
item = strings.TrimSpace(item)
446+
if item != "" {
447+
r.processInputItem(item, inputs)
448+
}
449+
}
444450
}
445451
}
446452
}
@@ -449,7 +455,13 @@ func (r *Runner) normalizeAndQueueInputs(inputs chan taskInput) error {
449455
for scanner.Scan() {
450456
text := scanner.Text()
451457
if text != "" {
452-
r.processInputItem(text, inputs)
458+
// Split by comma to support comma-separated values in a single line
459+
for _, item := range strings.Split(text, ",") {
460+
item = strings.TrimSpace(item)
461+
if item != "" {
462+
r.processInputItem(item, inputs)
463+
}
464+
}
453465
}
454466
}
455467
}

0 commit comments

Comments
 (0)