-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add support for copying multiple files to clipboard #13
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=> #14