diff --git a/shot.py b/shot.py index 51a991b..3a44310 100644 --- a/shot.py +++ b/shot.py @@ -179,8 +179,9 @@ def __call__(self): shutil.move(screenshot_to_copy, self.dst) # no need for else, should be handled above by `if cmd not in accepted_cmds:` if not self.quiet: + screenshot_names = [os.path.basename(v) for v in self.screenshots_to_copy] self.console.print( - f"{commands[cmd]} the following files to {self.dst} successfully!\n{self.screenshots_to_copy}", + f"{commands[cmd]} the following files from {self.screenshot_dir} to {self.dst} successfully!\n{screenshot_names}", style="green", ) except Exception as e: diff --git a/tests/unit/test_shot.py b/tests/unit/test_shot.py index 55cb44f..9a13f12 100644 --- a/tests/unit/test_shot.py +++ b/tests/unit/test_shot.py @@ -51,7 +51,8 @@ def test_default_args(self, check_output_mock, copy_mock, glob_mock): s() s.console.print.assert_called_with( - "Copied the following files to . successfully!\n['/tmp/tests/first']", style="green" + "Copied the following files from /tmp/tests to . successfully!\n['first']", + style="green", ) check_output_mock.assert_has_calls(check_output_calls) copy_mock.assert_has_calls(copy_mock_calls) @@ -131,7 +132,7 @@ def test_move(self, check_output_mock, move_mock, glob_mock): s.console.print = MagicMock() s() s.console.print.assert_called_with( - "Moved the following files to . successfully!\n['/tmp/tests/first']", style="green" + "Moved the following files from /tmp/tests to . successfully!\n['first']", style="green" ) check_output_mock.assert_has_calls(check_output_calls) move_mock.assert_has_calls(move_mock_calls) @@ -163,7 +164,10 @@ def test_not_enough_files_yes(self, check_output_mock, copy_mock, glob_mock): copy_mock_calls = [call("/tmp/tests/1", ".")] print_mock_calls = [ call("Warning: there are not enough files to copy with start:1, num:2", style="yellow"), - call("Copied the following files to . successfully!\n['/tmp/tests/1']", style="green"), + call( + "Copied the following files from /tmp/tests to . successfully!\n['1']", + style="green", + ), ] s = Shot(num=2, yes=True) @@ -190,7 +194,7 @@ def test_changing_extension_yes(self, check_output_mock, copy_mock, glob_mock): "Warning: src and dst extensions don't match. src: .txt, dst: .md", style="yellow" ), call( - "Copied the following files to ./first.md successfully!\n['/tmp/tests/first.txt']", + "Copied the following files from /tmp/tests to ./first.md successfully!\n['first.txt']", style="green", ), ] @@ -219,7 +223,7 @@ def test_start_and_num(self, check_output_mock, copy_mock, glob_mock): s.console.print = MagicMock() s() s.console.print.assert_called_with( - "Copied the following files to . successfully!\n['/tmp/tests/2', '/tmp/tests/3']", + "Copied the following files from /tmp/tests to . successfully!\n['2', '3']", style="green", ) check_output_mock.assert_has_calls(check_output_calls)