Run on a file or directory
See original GitHub issueThanks for this handy tool!
It would be nice to be able to run pyupgrade on a directory, and have it process all .py files in that directory and subdirectories.
For example:
pyupgrade .
This would be similar to other tools like Flake8 and Black.
In the meantime, this works:
pyupgrade `find . -name "*.py"`
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to run a file in a different directory - Ask Ubuntu
No you don't need to use: cd home/directoryA/directoryB/directoryC/DirectoryD ./somefile. You can simply run the command by prefixing it ...
Read more >chmod - Change the mode of a file or directory - IBM
A superuser or the file owner can use a chmod command or chmod() function to change two options for an executable file. The...
Read more >How to Run Files in Linux: 9 Steps (with Pictures) - wikiHow
1. Open a file manager application. Most Linux distributions come with a default file manager program. This may be Nautilus, Thunar, Dolphin, Krusader...
Read more >Chapter 7 - FILE PERMISSIONS
Read, write and execute permissions are set for directories as well as files. Read permission means that the user may see the contents...
Read more >Execute a Command Whenever File or Directory Changes
Learn how to monitor a directory recursively and execute a command whenever the files and directories within it change.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@asottile - thank you for this wonderful tool!
I would also find this option useful to pass a folder. Yes, it’s a bit of code to walk the directories, but
black
has a very good implementation that could be copied.It’s not obvious to me why one would use
pre-commit
to upgrade a given codebase. Upgrading is a one-time action, at least that’s how I want to use it. So why make this a pre-commit hook? – @asottile maybe you could clarify a bit at the start of the readme.Hi @asottile I understand that you are advocating for pre-commit but I believe it would be good to mention the trick with
pyupgrade
find . -name “*.py” -type f`` in a “Usage” section of the readme as well. What do you think?