aj-bagwell / clio

A rust library for parsing command line file name arguements
12 stars 7 forks source link

Atomic write support? #11

Closed epage closed 1 year ago

epage commented 1 year ago

This looks very close to what I was hoping for for clap-rs/clap#4074.

One thing I thing click.File has that this doesn't is the ability to configure writes to be atomic.

aj-bagwell commented 1 year ago

This was a great idea! I have added it in version 0.3.0 to Output. You can make it atomic by specifying it in the clap anotation like you suggested.

    /// Write output atomically using temp file and atomic rename
    #[clap(value_parser = clap::value_parser!(Output).atomic())]
    config_file: Output,