Skip to content

Commit 152a3c2

Browse files
committed
Make pyperclip failure error message more specific
1 parent 4e76883 commit 152a3c2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cmd2/cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ def _redirect_output(self, statement: Statement) -> Tuple[bool, utils.Redirectio
20462046
elif statement.output:
20472047
import tempfile
20482048
if (not statement.output_to) and (not self._can_clip):
2049-
self.perror("Cannot redirect to paste buffer; install 'pyperclip' and re-run to enable")
2049+
self.perror("Cannot redirect to paste buffer; missing 'pyperclip' and/or pyperclip dependencies")
20502050
redir_error = True
20512051

20522052
elif statement.output_to:

tests/test_cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ def test_clipboard_failure(base_app, capsys):
13321332
# Make sure we got the error output
13331333
out, err = capsys.readouterr()
13341334
assert out == ''
1335-
assert "Cannot redirect to paste buffer; install 'pyperclip' and re-run to enable" in err
1335+
assert 'Cannot redirect to paste buffer;' in err and 'pyperclip' in err
13361336

13371337

13381338
class CommandResultApp(cmd2.Cmd):

0 commit comments

Comments
 (0)