Jupiee / rawst

Rawst is cli downloader, written in rust
GNU General Public License v3.0
14 stars 2 forks source link

Improvement: Take advantage of clap's derive feature #8

Closed Dietr1ch closed 2 weeks ago

Dietr1ch commented 2 weeks ago

Hi,

Hey, I see that src/cli/parser.rs parses the command line arguments in a sort of hand written way using clap.

clap has feature for deriving the parser code from structs (called derive), which is pretty neat.

I think we can have 3 sub-commands, download, history and resume, and that download can snag the threads, input-file and save-as flags as they are not needed by the other subcommands.

Also, having download as a sub-command may seem a bit of a burden (raswt download https://my_iri is longer than raswt https://my_iri, but there's a sort of hack to have a default subcommand that would avoid this extra typing).

What do you think about it?

Jupiee commented 2 weeks ago

Hello,

I agree with you, keeping the flags organized will be neat and also eventually as the project grows the list of flags will increase too so it would be better to use derive feature.

Dietr1ch commented 2 weeks ago

I took a stab at this, but I ended up moving it to an exploration branch (dev/exp/clap) as it turns out it needs more changes than what I'm willing to do in a single commit.

Jupiee commented 2 weeks ago

Yeah that's quite a lot of changes, I checked it out and looks pretty organized now.