lsd icon indicating copy to clipboard operation
lsd copied to clipboard

Use StructOpt (instead of clap) to reduce boilerplate

Open KSXGitHub opened this issue 4 years ago • 0 comments

Problem

I can't help but notice the code used to parse CLI argument being overly repetitive:

  • There are two files (app.rs and flags.rs) just to parse CLI arguments, which repeat the same names multiple times.
  • In app.rs, .multiple(true).number_of_values(1) is repeated multiple times.
  • In flags.ts, value conversions happen in multiple places.

Request

Instead of using Clap directly, I propose we should switch to StructOpt to reduce boilerplate. StructOpt is a wrapper macro around Clap so I am confident that there would be no breaking change.

KSXGitHub avatar Apr 18 '20 04:04 KSXGitHub