Skip to content

Commit 6b45d33

Browse files
authored
Add --skip-prompt as a synonym for --no-confirm (#170)
* Add --skip-prompt Authored-by: Juno <[email protected]>
1 parent b4ff739 commit 6b45d33

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ Further examples and use cases are found in the [accompanying Jupyter Notebook](
4848
options:
4949
-h, --help Show this help message and exit
5050
-v, --version Show program's version number and exit
51-
--no-confirm Bypass any confirmation prompts
51+
--no-confirm, --skip-prompt
52+
Bypass any confirmation prompts
5253
-n, --no-resize Do not resize images to the specified width and height, but instead use the original image's pixels.
5354
-i, --input INPUT
5455
Folder where images to crop are located. Default: current working directory

Diff for: autocrop/cli.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ def parse_args(args):
245245
action="version",
246246
version="%(prog)s version {}".format(__version__),
247247
)
248-
parser.add_argument("--no-confirm", action="store_true", help=help_d["y"])
248+
parser.add_argument(
249+
"--no-confirm",
250+
"--skip-prompt",
251+
action="store_true", help=help_d["y"]
252+
)
249253
parser.add_argument(
250254
"-n",
251255
"--no-resize",

Diff for: tests/test_cli.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,16 @@ def test_user_does_not_get_prompted_if_output_d_is_given(mock_confirm):
192192

193193
@mock.patch("autocrop.cli.main", lambda *args: None)
194194
@mock.patch("autocrop.cli.confirmation")
195-
def test_user_does_not_get_prompted_if_no_confirm(mock_confirm):
195+
@pytest.mark.parametrize(
196+
"flag",
197+
[
198+
("--no-confirm"),
199+
("--skip-prompt"),
200+
],
201+
)
202+
def test_user_does_not_get_prompted_if_no_confirm(mock_confirm, flag):
196203
mock_confirm.return_value = False
197-
sys.argv = ["", "-i", "tests/data", "--no-confirm"]
204+
sys.argv = ["", "-i", "tests/data", flag]
198205
assert mock_confirm.call_count == 0
199206
command_line_interface()
200207
assert mock_confirm.call_count == 0

0 commit comments

Comments
 (0)