Doctave / doctave

A batteries-included developer documentation site generator
https://cli.doctave.com
MIT License
549 stars 33 forks source link

Upgrade arg parsing to clap v3 with derive #36

Closed tranzystorekk closed 4 months ago

tranzystorekk commented 2 years ago

Changes the arg parsing to use clap 3.0 with its newly added derive feature, that largely simplifies command line definition and automates away some boilerplate type parsing (notably the port flag).

Note: by default clap now outputs colorful help prompts, let me know if it should be disabled.

begleynk commented 2 years ago

Thanks for submitting this!

As long as we respect the --no-color flag in Doctave I think it's fine to display colors in the help prompts. At least personally I like colorful CLIs :)

begleynk commented 2 years ago

Haven't had a chance to test this yet, but did you notice any changes in compile time after this change? I'm just aware that clap is a bit of a heavy dependency and relying on derive's can sometimes have a dramatic effect on compile times.

Slower compile times are not necessarily a deal breaker but wanted to check - just something to be aware of.

tranzystorekk commented 2 years ago

On my WSL2 with Intel Core i5-9300H @ 8x 2.4GHz cargo build sees an increase roughly from 50s to 54s

EDIT: that information is probably irrelevant since I just did one run on master and on this branch, without a benchmark

tranzystorekk commented 2 years ago

Benchmark results:

master: doctave-master

pr branch: doctave-clap

So roughly a 1 second increase, IMO reasonable 😁