Conversation
supitsdu
commented
Jun 23, 2024
- Updated main.go to allow specifying multiple file paths
- Concatenated content from multiple files before copying to clipboard
- Updated usage message to reflect new functionality
- Updated main.go to allow specifying multiple file paths - Concatenated content from multiple files before copying to clipboard - Updated usage message to reflect new functionality
| if len(flag.Args()) == 1 { | ||
| // Read the content from the file path provided | ||
| contentStr, err = readFromFile(flag.Arg(0)) | ||
| if len(flag.Args()) > 0 { |
There was a problem hiding this comment.
The complexity of the code is increased by the multiple branching if
What about moving these to a function
contentStr, err := parseContent(flag)
if err != nil {
fmt.Println
os.Exitt(1)
}
// …
func parseContent(flag) string, error {
if directText != {
return *directText
}
// …
}There was a problem hiding this comment.
Thank you for the suggestion! Refactoring to move the content parsing logic into a new parseContent function does indeed reduce complexity in the main function. I agree with the approach and will address this in a future update, as I'm currently focusing on the installation script. If you’d like to expedite this improvement, please feel free to open a PR.
There was a problem hiding this comment.
I can but not in the next days, so I'm moving my comment to an issue, so it can be addressed later either by me, you, or anyone
There was a problem hiding this comment.
Thank you for the suggestion and for understanding. Moving your comment to an issue is a great idea so that it can be tracked and addressed later by anyone available. I appreciate your input and look forward to collaborating on this improvement when possible. If you or anyone else gets a chance to work on it before I do, that would be fantastic.