Jupiee / rawst

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

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

Open Dietr1ch opened 6 hours ago

Dietr1ch commented 6 hours 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 5 hours 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.