diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-06-30 17:11:06 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-06-30 17:11:06 -0400 |
commit | 959aeed2438f00720845383daba2a1f30097a8dc (patch) | |
tree | 9b12aa422b2a8b19d47b8045c8a76368d5254d7d /cmd2.py | |
parent | ff3583a67ee02550acbfe85c1599688d941643cf (diff) | |
download | cmd2-git-959aeed2438f00720845383daba2a1f30097a8dc.tar.gz |
Added code to set can_clip to False on Linux if can't copy/paste clipboard
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.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -303,8 +303,13 @@ def options(option_list, arg_desc="arg"): return option_setup -# Can we access the clipboard? +# Can we access the clipboard, always true on Windows and Mac, but only sometimes on Linux can_clip = True +if sys.platform == 'linux': + try: + pyperclip.paste() + except pyperclip.exceptions.PyperclipException: + can_clip = False def get_paste_buffer(): |