Skip to content

Add line mode to CLI for processing input line by line. #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 1, 2025

Conversation

catatsuy
Copy link
Owner

@catatsuy catatsuy commented Feb 1, 2025

This pull request introduces a new input processing mode to the purl tool, allowing it to handle data on a line-by-line basis. The changes include updates to the documentation, the command-line interface, and the test cases to support this new mode.

Documentation Updates:

  • Added a new section "Input Processing Modes" to the README.md file, explaining the two ways purl can read input: Multi-Line Mode for files and Line Mode for standard input.

Command-Line Interface Updates:

  • Introduced a new lineMode flag to the CLI struct in internal/cli/cli.go.
  • Updated the parseFlags method to handle the new -line option and automatically enable line mode when reading from standard input. [1] [2]
  • Modified the replaceProcess and extractProcess methods to support line-by-line processing when lineMode is enabled. [1] [2] [3]

Test Case Updates:

  • Added new test cases in internal/cli/cli_test.go to verify the functionality of the line mode, including tests for line-by-line replacement and extraction. [1] [2] [3] [4]

@catatsuy catatsuy merged commit de8fee5 into main Feb 1, 2025
5 checks passed
@catatsuy catatsuy deleted the feature-line-mode-support branch February 1, 2025 07:28
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.

1 participant