Skip to content
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

Improve line-by-line processing to handle CRLF files #53

Merged
merged 3 commits into from
May 18, 2024

Conversation

catatsuy
Copy link
Owner

@catatsuy catatsuy commented May 18, 2024

This pull request mainly modifies the internal/cli/cli.go file and the corresponding test files to improve the processing of text replacement and filtering. The changes include replacing the string type with []byte for the replacement variable and the input lines, modifying the replaceProcess and filterProcess methods to read input line by line without changing newline characters, and updating the matchesFilters and colorText functions to work with []byte instead of string.

Changes in type and reading method:

  • internal/cli/cli.go: Changed the type of the replacement variable from string to []byte in the Run method. [1] [2]
  • internal/cli/cli.go: Modified the replaceProcess and filterProcess methods to read input line by line when input is from a pipe without changing newline characters.

Changes in functions:

  • internal/cli/cli.go: Updated the matchesFilters and colorText functions to work with []byte instead of string.

Test changes:

@catatsuy catatsuy changed the title fix line by line processing Improve line-by-line processing to handle CRLF files May 18, 2024
@catatsuy catatsuy merged commit 440d20a into main May 18, 2024
3 checks passed
@catatsuy catatsuy deleted the fix-line-by-line-processing branch May 18, 2024 07:33
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