summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherr kaste <herr.kaste@gmail.com>2022-11-11 13:20:47 +0100
committerherr kaste <herr.kaste@gmail.com>2022-11-11 13:20:47 +0100
commit8aeff224288497aae97f00dd3c878a556a8776cd (patch)
treeb92513a14f72957eadf983da00392b90a9b6ec2d
parentdcdb89d31807b9278f9c535d6e1c14e5ec2da9ec (diff)
downloadisort-8aeff224288497aae97f00dd3c878a556a8776cd.tar.gz
Derive `settings_path` from `--filename`
Fixes #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 09734212 (Reuse config when items passed in through stdin as used when items passed in explicitly).
-rw-r--r--isort/main.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/isort/main.py b/isort/main.py
index 6d1987d2..447561d6 100644
--- a/isort/main.py
+++ b/isort/main.py
@@ -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"]):