Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing a directory as command-line argument. #13

Closed
sjoerdjob opened this issue May 17, 2021 · 1 comment
Closed

Support passing a directory as command-line argument. #13

sjoerdjob opened this issue May 17, 2021 · 1 comment

Comments

@sjoerdjob
Copy link
Contributor

When a directory has been passed as a command-line argument, the current error is

djhtml: error: argument filenames: can't open 'foo': [Errno 21] Is a directory: 'foo'

Ideally, it would instead recurse over the directory, and apply djhtml to each of the files found in the directory. Compare with black ..

[consider: which files should and should not be handled for recursion?]

  • All .html files
  • Should .js files also be handled, but starting in JS mode instead of HTML mode?
  • Similar for .css files?
  • Don't touch emacs/vim/... save-files. (Filename~, .Filename.swp)?
@JaapJoris
Copy link
Member

First of all, thank you very much for your suggestion! While this would be a nice feature, the same can already be accomplished by the find and xargs command line tools:

$ find -name *.html | xargs djhtml -i

This has the added benefit that you can include/exclude any files you want, e.g.:

$ find -name *.html -not -path "./someapp/*" | xargs djhtml -i

Your second suggestion is something that I would definitely want to implement though: indenting CSS and JS files. I propose the addition of two separate commands: djcss and djjs, which start in the DjCSS and DjJS modes, respectively. It could actually be the same executable where the mode depends on how it's called, similar to how bash runs in POSIX mode when called as sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants