diff options
author | herr kaste <herr.kaste@gmail.com> | 2022-11-11 13:20:47 +0100 |
---|---|---|
committer | herr kaste <herr.kaste@gmail.com> | 2022-11-11 13:20:47 +0100 |
commit | 8aeff224288497aae97f00dd3c878a556a8776cd (patch) | |
tree | b92513a14f72957eadf983da00392b90a9b6ec2d | |
parent | dcdb89d31807b9278f9c535d6e1c14e5ec2da9ec (diff) | |
download | isort-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.py | 2 |
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"]): |