your-tools / ruplacer

Find and replace text in source files
BSD 3-Clause "New" or "Revised" License
426 stars 25 forks source link

Add `-V`, `--version` option #85

Closed homeworkprod closed 2 years ago

homeworkprod commented 2 years ago

I find it very helpful to have a tool tell me it's version so I can consider upgrading to a newer version or track down bugs.

This change adds the common --version option/switch (along with -V). Fortunately, Clap makes this very easy by using a magic command attribute: https://github.com/clap-rs/clap/blob/v3.1.15/examples/derive_ref/README.md#command-attributes

Output of ruplacer --version:

ruplacer 0.6.4

Additional output of ruplacer --help:

ruplacer 0.6.4

[…]

    -V, --version
            Print version information

[…]
dmerejkowsky commented 2 years ago

Nice, thanks :)

dmerejkowsky commented 2 years ago

Got to say, this was a very good PR:

1/ Explain the rationale 2/ Clearly show the consequences of the changes 3/ Contain link to the relevant documentation

Not only was the project improved, but I also learned something new about clap.

Thanks again, take care.

homeworkprod commented 2 years ago

@dmerejkowsky Thank you for your kind words, and for ruplacer as well! Glad I could help a tiny bit.