diff --git a/README.md b/README.md index c3a055a..53bf2c7 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,9 @@ code base is implemented in. - [ ] Investigate ways of extracting and backporting Python3.10+ `ast` implementation to lower Python versions. ## Release notes +- v2.4.1: + - Add `--version` option to show `deadcode` version. + - Use stdout for `deadcode` output. - v2.4.0: - Add `--only` option that accepts filenames only which will be reflected in the output and modified. This option can be used with `--fix` and `--fix --dry` options as well as for simple unused code detection without fixing. diff --git a/deadcode/cli.py b/deadcode/cli.py index 2b15ea4..4b4f54e 100644 --- a/deadcode/cli.py +++ b/deadcode/cli.py @@ -37,5 +37,10 @@ def main( return None +def print_main() -> None: + if result := main(): + print(result) + + if __name__ == '__main__': - main() + print_main() diff --git a/pyproject.toml b/pyproject.toml index 2609249..5a3cbdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ test = [ ] [project.scripts] -deadcode = "deadcode.cli:main" +deadcode = "deadcode.cli:print_main" [project.urls] homepage = "https://github.com/albertas/deadcode"