Update file path variable to hold multiple file paths #33
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.
This pull request primarily focuses on enhancing the functionality of the command-line interface (CLI) in the
internal/cli/cli.go
file. The changes enable the CLI to handle multiple files instead of a single file. This is achieved by modifying theCLI
struct and several functions within it, includingRun
,validateInput
,replaceProcess
, andfilterProcess
. Thecli_test.go
file has also been updated to test the new functionality, and a new test filetestdata/testa.txt
has been added.Changes to
CLI
struct and functions:internal/cli/cli.go
: Updated theCLI
struct to replace thefilePath
string field with afilePaths
slice of strings, allowing multiple files to be processed.internal/cli/cli.go
: Modified theRun
function to iterate over thefilePaths
slice and process each file. Additional code was added to handle the case when no file paths are provided. [1] [2] [3]internal/cli/cli.go
: ThevalidateInput
function was updated to validate each file path in thefilePaths
slice.internal/cli/cli.go
: ThereplaceProcess
andfilterProcess
functions were modified to accept anio.Reader
parameter, which is used to read from the file being processed.Test updates:
internal/cli/cli_test.go
: Added new test cases inTestRun_successProcess
to test the processing of multiple files.internal/cli/cli_test.go
: Added a new test functionTestRun_failToProvideFiles
to test scenarios where file provision fails.internal/cli/cli_test.go
: Updated existing test functions to pass anio.Reader
parameter when callingReplaceProcess
andFilterProcess
. [1] [2]Additional changes:
internal/cli/export_test.go
: Updated the exportedReplaceProcess
andFilterProcess
functions to accept anio.Reader
parameter.internal/cli/testdata/testa.txt
: Added a new test file for testing the processing of multiple files.