Skip to content

feat: support multiple files in --file flag#53

Merged
pixincreate merged 2 commits intomasterfrom
feature/multi-file-support
May 4, 2026
Merged

feat: support multiple files in --file flag#53
pixincreate merged 2 commits intomasterfrom
feature/multi-file-support

Conversation

@pixincreate
Copy link
Copy Markdown
Owner

Summary

  • Allow multiple --file flags or comma-separated paths in a single command
  • Example: key-watch --file a.txt --file b.txt or key-watch --file a.txt,b.txt

Changes

  • src/cli.rs: Changed file: Option<String> to file: Vec<String> with value_delimiter = ','
  • src/scanner.rs: Updated to extend target_paths from the vec instead of single option
  • tests/scanner_tests.rs: Added test_multiple_files_scan test
  • Fixed existing tests to use vec![] instead of None

Closes

Closes #15

Copilot AI review requested due to automatic review settings May 4, 2026 17:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates KeyWatch’s CLI and scan pipeline to accept multiple file targets through --file, aligning the scanner with issue #15’s request to scan more than one file in a single invocation.

Changes:

  • Changes CliOptions.file from a single optional path to a vector with comma-delimited parsing support.
  • Updates run_scan to add all provided file paths to the scan target list.
  • Refreshes scanner/hook tests and adds a multi-file scan test.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/cli.rs Expands the --file CLI option to accept multiple values and comma-separated input.
src/scanner.rs Switches scan target collection from a single file path to all provided file paths.
tests/scanner_tests.rs Updates scanner tests for the new Vec<String> shape and adds a multi-file scan case.
tests/hooks_tests.rs Adjusts hook tests to construct CliOptions with an empty file list.

Comment thread src/cli.rs Outdated
Comment thread src/cli.rs Outdated
Comment thread src/scanner.rs Outdated
Comment thread tests/scanner_tests.rs
@pixincreate pixincreate changed the title feat: support multiple files in --file flag feat: support multiple files in --file flag May 4, 2026
@pixincreate pixincreate force-pushed the feature/multi-file-support branch from fd80353 to 9079efe Compare May 4, 2026 17:56
- Allow multiple --file flags or comma-separated paths
- Add test for multi-file scanning
- Fix test code to use Vec<String> instead of Option<String>

Closes #15
@pixincreate pixincreate force-pushed the feature/multi-file-support branch from c1afb1d to 5b8547e Compare May 4, 2026 18:03
@pixincreate pixincreate merged commit 1dbafa1 into master May 4, 2026
9 of 10 checks passed
@pixincreate pixincreate deleted the feature/multi-file-support branch May 4, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactoring to support multiple files at once

2 participants