Interesting. I didn’t even know clean could clean just a single file. :)
The problem is that there are two loops, one for html and one for css, but for single files, both are always run. For directories, the list of extensions on the loop is respected.
I’m not sure of the best way to fix that, or more correctly what way Alex would prefer, so I think I’ll leave it for him.
Also, I accidentally discovered that giving it a filename that doesn’t exist stack traces instead of pretty-printing.
Traceback (most recent call last):
File "/usr/local/bin/se", line 33, in <module>
sys.exit(load_entry_point('standardebooks', 'console_scripts', 'se')())
File "/Users/vrice/setools/se/main.py", line 81, in main
sys.exit(getattr(module, command_function)(args.plain_output))
File "/Users/vrice/setools/se/commands/clean.py", line 30, in clean
se.formatting.format_xml_file(filepath)
File "/Users/vrice/setools/se/formatting.py", line 516, in format_xml_file
with open(filename, "r+", encoding="utf-8") as file:
FileNotFoundError: [Errno 2] No such file or directory: '/Books/willa-cather_one-of-ours/src/epub/text/chapter-1.xhtml'