From c467a98e06b8f65a757263c063231582c413d8ab Mon Sep 17 00:00:00 2001 From: Timothy Crosley Date: Wed, 14 Jul 2021 22:52:17 -0700 Subject: [PATCH] Fixed #1781: CLI flag shouldn't take any arguments. --- CHANGELOG.md | 1 + isort/main.py | 1 + tests/unit/test_main.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbaeb04dc..9f1c16aec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Find out more about isort's release policy [here](https://pycqa.github.io/isort/ ### 5.9.3 TBD - Improved text of skipped file message to mention gitignore feature. - Fixed #1779: Pylama integration ignores pylama specific isort config overrides. + - Fixed #1781: `--from-first` CLI flag shouldn't take any arguments. ### 5.9.2 July 8th 2021 - Improved behavior of `isort --check --atomic` against Cython files. diff --git a/isort/main.py b/isort/main.py index 2a4ac56f5..fc893a4f8 100644 --- a/isort/main.py +++ b/isort/main.py @@ -462,6 +462,7 @@ def _build_arg_parser() -> argparse.ArgumentParser: "--ff", "--from-first", dest="from_first", + action="store_true", help="Switches the typical ordering preference, " "showing from imports first then straight ones.", ) diff --git a/tests/unit/test_main.py b/tests/unit/test_main.py index 78d1e9374..84cc3e116 100644 --- a/tests/unit/test_main.py +++ b/tests/unit/test_main.py @@ -78,6 +78,7 @@ def test_parse_args(): assert main.parse_args(["--combine-straight-imports"]) == {"combine_straight_imports": True} assert main.parse_args(["--dont-follow-links"]) == {"follow_links": False} assert main.parse_args(["--overwrite-in-place"]) == {"overwrite_in_place": True} + assert main.parse_args(["--from-first"]) == {"from_first": True} def test_ascii_art(capsys): @@ -562,7 +563,7 @@ def test_isort_with_stdin(capsys): """ ) - main.main(["-", "--ff", "FROM_FIRST"], stdin=input_content) + main.main(["-", "--ff"], stdin=input_content) out, error = capsys.readouterr() assert out == (