Skip to content

Added 3rd-party dependency on pyperclip for clipboard copy/paste functionality#155

Merged
tleonhardt merged 4 commits intomasterfrom
pyperclip
Jun 30, 2017
Merged

Added 3rd-party dependency on pyperclip for clipboard copy/paste functionality#155
tleonhardt merged 4 commits intomasterfrom
pyperclip

Conversation

@tleonhardt
Copy link
Copy Markdown
Member

The custom code which was previously in cmd2 for copy and paste to/from clipboard/pastebuffer functionality and was different for each OS has been removed.

It has been replaced with much simpler code using the pyperclip module.

This does add an additional 3rd-party dependency to cmd2, but it is worth it, because pyperclip works in a lot more situations than the previous code did.

This closes #151

- Added a 3rd-party dependency on the pyperclip module

TODO: Rigorous test on all OSes, particularly Linux systems without xclip
…board

If Pyperclip could not find a copy/paste mechanism for your system, then
cmd2.can_clip gets set to False.

If cmd2.can_clip is False, then the "send_to_paste_buffer" test gets skipped.
So it turns out that on Linux, it sys.platform is "linux2" in Python 2 and "linux" in Python 3, so if doing a comparsion, need to do a .startswith() instead of a ==
@tleonhardt tleonhardt added this to the 0.7.4 milestone Jun 30, 2017
@tleonhardt tleonhardt self-assigned this Jun 30, 2017
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 30, 2017

Codecov Report

Merging #155 into master will increase coverage by 4.27%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   84.25%   88.53%   +4.27%     
==========================================
  Files           1        1              
  Lines        1207     1151      -56     
==========================================
+ Hits         1017     1019       +2     
+ Misses        190      132      -58
Impacted Files Coverage Δ
cmd2.py 88.53% <93.33%> (+4.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 309c3ec...613a1b7. Read the comment docs.

@tleonhardt tleonhardt merged commit ed54110 into master Jun 30, 2017
@tleonhardt tleonhardt deleted the pyperclip branch June 30, 2017 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore replacing custom clipboard code with pyperclip

1 participant