marked
marked copied to clipboard
Is it possible to add a noclobber option?
Describe the feature so that any existing file is not overwritten
Why is this feature necessary? prevent accidentally overwriting the file
Describe alternatives you've considered
Not sure what you mean. marked doesn't write to any files.
Not sure what you mean. marked doesn't write to any files.
when we do marked -i README.md -o README.html
You want an option to make sure the input file is not the same as the output file?
You want an option to make sure the input file is not the same as the output file?
note marked -i README.md -o README.html the md vs html
note
marked -i README.md -o README.htmlthemdvshtml
So it shouldn't overwrite the input file. I'm not exactly sure what you are looking for.
If you don't want to overwrite the file can't you just make sure the files are different? I don't know how adding an option would help that.
for example, Bash has an option to set noclobber, and when we use any app, we save it as README.html, it'd say the file already exists, would you like to save anyway. So I think commands can make sense if it has a noclobber option, just so that there is no accidental overwrite.
I would be ok with that if you want to create a PR
I actually can't find an example of a CLI implementing noclobber -- can someone here send an example of a CLI either reading from the bash environment to detect if the noclobber option was set, or explicitly passing a flag?
cp has a --no-clobber option to prevent overriding files. https://man7.org/linux/man-pages/man1/cp.1.html