mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
528 stars 342 forks source link

Add a new option to overwrite an output file, if it already exists #867

Closed nkhancock closed 1 year ago

nkhancock commented 1 year ago

It is sometimes annoying that pyang throws a FileExistsError if an output file already exists, such as when generating PlantUML code for a YANG module, for example, when the YANG module is updated. Currently, an existing PlantUML file has to be deleted before invoking pyang.

This pull requests adds a new option -O, --overwrite to allow the user to choose to overwrite the output file, if it already exists. By default the option is false and so this change is backwards compatible.