-
-
Notifications
You must be signed in to change notification settings - Fork 197
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: copy to clipboard #234
Conversation
9c9fdc1
to
876040b
Compare
Closes #232 |
Experimented with a few approaches, |
Noticed that other confirmation dialogs such as overwrite file have the "copy" option. |
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.
Looks good, nice workaround with the preview stuff, but some concerns about pyperclip.
gptme/util.py
Outdated
@@ -131,6 +133,7 @@ def epoch_to_age(epoch): | |||
def print_preview(code: str, lang: str): # pragma: no cover | |||
print() | |||
print("[bold white]Preview[/bold white]") | |||
set_text(code) |
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.
Won't really work for patches, but I guess that's ok for now.
|
7246af7
to
e71aaa8
Compare
a96b652
to
f8cae58
Compare
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.
❌ Changes requested. Reviewed everything up to f263c5d in 1 minute and 3 seconds
More details
- Looked at
312
lines of code in6
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. gptme/util.py:343
- Draft comment:
Theget_system_distro
function is duplicated in multiple files. Consider defining it in one place and importing it where needed to avoid redundancy. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is speculative as it assumes the function is duplicated without providing evidence. The diff only shows the function being added here, and without evidence of duplication, the comment does not meet the criteria for being kept.
I might be missing the broader context of the codebase where this function could indeed be duplicated. However, based on the provided information, there's no evidence of duplication.
The task is to review the diff and comments based on the provided information. Without evidence of duplication in the diff or context, the comment should be removed.
Remove the comment as it is speculative and not based on evidence from the provided diff or context.
2. gptme/util.py:355
- Draft comment:
Theget_installed_programs
function is duplicated in multiple files. Consider defining it in one place and importing it where needed to avoid redundancy. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is about a cross-file issue, which is not relevant to the changes made in this diff. The rules specify to ignore cross-file issues and focus only on the file being reviewed. Since there's no evidence of duplication within this file, the comment should be removed.
I might be missing the context of other files where this function could be duplicated, but the task is to focus only on the current file.
The rules are clear about ignoring cross-file issues, so the lack of evidence in this file is sufficient to disregard the comment.
Remove the comment as it pertains to a cross-file issue, which is not relevant to the current diff.
3. gptme/util.py:153
- Draft comment:
Theprint_preview
function has been modified to include acopy
parameter, but the logic for settingcopiable
andset_copytext
is not clear. Ensure these are only set when necessary. - Reason this comment was not posted:
Confidence changes required:50%
Theprint_preview
function has been modified to include acopy
parameter, but the logic for settingcopiable
andset_copytext
is not clear. It should be ensured that these are only set when necessary.
4. gptme/platform_utils.py:20
-
Draft comment:
Duplicate functionget_installed_programs
found ingptme/util.py
. Use the existing function instead of adding a new one. -
function
get_installed_programs
(util.py) -
Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_n5fjgRTZQRD07l0Y
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
7c82ff4
to
ec64640
Compare
feat: add copiable variable fix: update the copystr refactor: revert to "[c] to copy" feat: copy to clipboard refactor: revert to [c] to copy. handle circular import feat: simplify the input handling.
33693fc
to
28e11a4
Compare
@ellipsis-dev review |
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.
❌ Changes requested. Reviewed everything up to 28e11a4 in 1 minute and 5 seconds
More details
- Looked at
200
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. gptme/clipboard.py:28
- Draft comment:
Consider usingsubprocess.run(..., check=True)
to ensure that an exception is raised if the command fails, which can help in debugging and error handling. - Reason this comment was not posted:
Marked as duplicate.
2. gptme/clipboard.py:39
- Draft comment:
Consider usingsubprocess.run(..., check=True)
to ensure that an exception is raised if the command fails, which can help in debugging and error handling. - Reason this comment was not posted:
Marked as duplicate.
3. gptme/util.py:357
- Draft comment:
Theget_installed_programs
function is duplicated inshell.py
. Consider removing the one inshell.py
to avoid redundancy. - Reason this comment was not posted:
Confidence changes required:50%
Theget_installed_programs
function inutil.py
is duplicated inshell.py
. The one inshell.py
should be removed as it is not used and the one inutil.py
is more generic and used inclipboard.py
.
Workflow ID: wflow_fskQ5vvxcb7pEBGE
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@ErikBjare ping |
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.
See the remaining ellipsis comments (should fix mypy + lint warnings), looks good otherwise. Haven't actually tested it.
40ecd1d
to
6e4dfda
Compare
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
6e4dfda
to
4e07159
Compare
Nice, merged! |
Actually, I don't understand, there is the reason for building something unknown if you could just take clipman (an alternative to pyperclip) which was mentioned above. Or is there something missing? |
@NikitaBeloglazov There is no "building something unknown", the called executables should exist on their respective platforms. I don't want to add another dependency for something so simple. |
Closes #232
Important
Adds clipboard copy functionality with platform-specific handling, refactors utility functions, and integrates into shell and tmux modules.
set_copytext()
andcopy()
inclipboard.py
for clipboard management.xclip
,wl-copy
) and macOS (pbcopy
).get_system_distro()
andget_installed_programs()
toplatform_utils.py
andutil.py
.print_preview()
inutil.py
to support clipboard copying.execute_shell()
inshell.py
andexecute_tmux()
intmux.py
to useprint_preview()
with clipboard copy option.This description was created by for 28e11a4. It will automatically update as commits are pushed.