A Debian user complained that if you use a wildcard as input file name, and the wildcard unexpectedly expands to two names, then rst2html will overwrite your files:
http://bugs.debian.org/654690
Would if be possible to add an option for not overwriting output files, that you could add to your configuration file, and later override from command line if needed?
I'm inclined to answer "won't fix" or "not a bug" here.
If we did add a --no-clobber option, I very much doubt anyone would use it before it's too late.
no-clobber is ok, but
is ...
Sure, --no-clobber & --clobber-ok/--go-ahead-and-clobber/--overwrite or something like that. But my opinion is YAGNI: you ain't gonna need it. Anybody who clobbers their input files using wildcards is not likely to know about or use such options. (PEBKAC)
Even if we did implement such an option, I would not make it the default.
We have better things to spend our time on. Unless somebody champions this issue, I vote to close/reject it.
Since 3.3, Python's standard
open()
supports the "mode" argument value'x' open for exclusive creation, failing if the file already exists
which could help with the implementation of such an option.
The original problem (accidential overwriting because of shell expansion, http://bugs.debian.org/654690) would also be solved by a different syntax for the output file:
instead of
rst2html infile outfile
we could use the signaturewhich would:
I like the --output= solution
of course this will break a ton of scripts
therefor requires a deprecation warning
and will take years
Indeed.
We may start with deprecating the "-o" shortcut for "--output-encoding".
(And, for symmetry "-i" for "--input-encoding".)
Proposal:
Announce upcoming changes in Docutils 0.19
new option
--output=destination
in Docutils 0.19removal of the short options
-i
and-o
in Docutils 1.0removal of the second argument
<destination>
in Docutils 2.0accept more than one source document in Docutils 3.0
short option
-o
for--output
in Docutils 3.0The upcoming change to the command line API is now announced in the RELEASE-NOTES.
This is a work in progress due to backwards incompatible changes. It will be finished in Docutils2.0.