manolomartinez / greg

A command-line podcast aggregator
GNU General Public License v3.0
297 stars 37 forks source link

Completion support and stricter argument parsing #53

Closed FilipBB closed 8 years ago

FilipBB commented 8 years ago

Adds shell completion support for arguments and feed names through 'argcomplete' (https://github.com/kislyuk/argcomplete) and lets argparse handle more of the argument validation.

-Specified 'nargs' explicitly for the arguments that call the custom action. For options with one argument, nargs, if unspecified, will return a string, for options with more than one argument it will return a list. It seems simpler just to make it always return a list. For this reason some calls to args['names'] in greg.py were changed to args['names'][0].

-Added support for multiple arguments to the 'remove' option.

-'greg list' now sorts feeds before printing them.

FilipBB commented 8 years ago

Oops, this doesn't work with custom data dirs specified on the command line, I need to look into it further.

manolomartinez commented 8 years ago

This looks useful. I'm looking forward to a revised version of the patch.

I am currently working on rearranging the files in the repo: names are not very informative, and greg.py is too big. So perhaps hold the patch until I push that, hopefully in a week or so.

Thanks for taking the time to work on greg, @FilipBB !

FilipBB commented 8 years ago

Ok sure. I've fixed the issue with custom data dirs and configs setting choices for arguments, but argcomplete is no longer working so I've removed it for now. It doesn't seem to work with custom argparse actions, or at least not with mine. I'll have to look into it some more.

I've also added support for opml import/export (#7), see https://github.com/FilipBB/greg/commit/b7a874da76fbc7e40ed3ed4c24c1362157c7c371.

FilipBB commented 8 years ago

Ok, got argcomplete working. I had to add the custom action to an argcomplete safe list for it to parse. I've tried different combinations of custom configs, data dirs and default and they all seem to be working. Check it out whenever you have time: https://github.com/FilipBB/greg/commit/3a079e4a95959a817f1093963bcad2e149dee000

manolomartinez commented 8 years ago

Alright, thanks a lot! I will see which way is best for me to incorporate these changes, given the changes in the repo I was alluding to the other day. I will certainly incorporate them, though. They are great additions to greg.