Update to clap 4 + rework to declarative style
And here's something no-one asked for but i was interested in: Clap 4!
Saw recent clap release, also never had a chance to try it, so i decided to give it a go.
I think declarative style is easier to read(and args parsing is more explicit). Also i took some liberties with search and list args for filtering, turning them into discriminated union(since they are mutually exclusive).
This changes the interface a bit, but i though about it as a suggestion - i'll change it back to the way it works now, if you think it's not worth it.
As for the rest of the changes - same story, feel free to reject it if you don't need or like it, it was mostly done as a personal excercise :)
Hey, thanks again for getting another MR done, it's really appreciated :). I think this declarative style probably will have some benefits in terms of grouping data together, I'm definitely not close to rejecting this change. I'm doing some stuff at church today though so I won't be available until later this afternoon, but I'll get this checked out later today when I get some time.
You're correct on all your comments, thanks! Fixed.
Also, while refactoring I may have gone a bit overboard:
- implemented
searchin terms oflist - user
Itertoolsforunique_byinsearch/listresults - added
CachePackage.is_installed - resurrected
Cache.pkglist- it's more useful to iterate/filter over, imo, instead ofpkgmap - added
Cache.search()forpkgnameandpkgdesc - changed
generate_pkginfo_entryto usepkgnamedirectly - and some other minor fixes.
As per usual - feel free to comment on what should be reverted or reworked.
@hwittenborn - i can rebase to fresh master to get rid of conflicts, if this PR is still releveant?
Yeah, I still want to get this merged @tonky. I implemented this derive style in some code for makedeb, and it's definitely a lot cleaner than the builder method.
Feel free to rebase it, let me know if you need any help if any conflicts arise too, I'll be around :)