Skip to content

Commit

Permalink
Derive settings_path from --filename
Browse files Browse the repository at this point in the history
Fixes PyCQA#1989

`--filename` is a shortcut setting used only in the stdin case to set
the `settings_path`.
Generally, `--settings-path=<file_path>` == `--filename=<filename>`
should hold.

This functionality was removed in 0973421 (Reuse config when items
passed in through stdin as used when items passed in explicitly).
  • Loading branch information
kaste committed Nov 11, 2022
1 parent dcdb89d commit 8aeff22
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions isort/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,8 @@ def main(argv: Optional[Sequence[str]] = None, stdin: Optional[TextIOWrapper] =
return
if "settings_path" not in arguments:
arguments["settings_path"] = (
arguments.get("filename", None) or os.getcwd()
if file_names == ["-"] else
os.path.abspath(file_names[0] if file_names else ".")
)
if not os.path.isdir(arguments["settings_path"]):
Expand Down

0 comments on commit 8aeff22

Please sign in to comment.