doctave icon indicating copy to clipboard operation
doctave copied to clipboard

Upgrade arg parsing to clap v3 with derive

Open tranzystorekk opened this issue 3 years ago • 4 comments

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.

tranzystorekk avatar Jan 10 '22 23:01 tranzystorekk

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 avatar Jan 12 '22 07:01 begleynk

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.

begleynk avatar Jan 12 '22 07:01 begleynk

~~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 avatar Jan 12 '22 08:01 tranzystorekk

Benchmark results:

master: doctave-master

pr branch: doctave-clap

So roughly a 1 second increase, IMO reasonable 😁

tranzystorekk avatar Jan 12 '22 13:01 tranzystorekk