Skip to content

Commit

Permalink
Use stdout for deadcode output
Browse files Browse the repository at this point in the history
  • Loading branch information
albertas committed Aug 9, 2024
1 parent e128c7a commit b545cbd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion deadcode/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,10 @@ def main(
return None


def print_main() -> None:
if result := main():
print(result)


if __name__ == '__main__':
main()
print_main()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test = [
]

[project.scripts]
deadcode = "deadcode.cli:main"
deadcode = "deadcode.cli:print_main"

[project.urls]
homepage = "https://github.com/albertas/deadcode"
Expand Down

0 comments on commit b545cbd

Please sign in to comment.