Skip to content

Commit

Permalink
Merge pull request #1992 from kaste/fix-1989
Browse files Browse the repository at this point in the history
Derive `settings_path` from `--filename`
  • Loading branch information
timothycrosley authored Feb 4, 2023
2 parents 8f558f1 + 8aeff22 commit 5a53481
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion isort/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,9 @@ def main(argv: Optional[Sequence[str]] = None, stdin: Optional[TextIOWrapper] =
return
if "settings_path" not in arguments:
arguments["settings_path"] = (
os.path.abspath(file_names[0] if file_names else ".") or os.getcwd()
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"]):
arguments["settings_path"] = os.path.dirname(arguments["settings_path"])
Expand Down

0 comments on commit 5a53481

Please sign in to comment.