weecology/retriever

Clean up CLI to use the python interface

Closed this issue · 5 comments

In the python interface, we use the function def datasets(keywords=None, licenses=None):.
This should be able to return what we are doing in the main (CLI interface) at line.
and the results can be printed in the away that looks good in CLI(terminal)

Originally posted by @henrykironde in #1570 (comment)

Okay, so from what I understood is that the retriever ls -v command should also display the error message that at least one argument should be passed, right?

I found this in lib/get_opts.py

ls_parser.add_argument('-v',
                       help='verbose list of all datasets',
                       nargs='*',
                       default=False)

I think it was intended to display the verbose list of all datasets when no arguments are provided.

Also when I run retriever ls -v airports it displays the verbose for the airports dataset.

aakash01@aakash01-G3-3579:~/Desktop/gsoc/retriever (verbose-error)$ retriever ls -v airports
1. Dataset containing information on all airports on ouraiports.com
 airports
['airports', 'aeroplanes', 'airplanes', 'frequencies', 'runways', 'navaids', 'countries', 'regions']
Dataset containing information on all airports on ourairports.com
None
OurAirports.com, Megginson Technologies Ltd.

I just want to clarify before making any changes

Following are the changes observed after the commits

aakash01@aakash01-G3-3579:~/Desktop/gsoc/retriever (verbose-error)$ retriever ls -v
usage: retriever ls [-h] [-l L [L ...]] [-k K [K ...]] [-v V [V ...]]
retriever ls: error: argument -v: expected at least one argument
aakash01@aakash01-G3-3579:~/Desktop/gsoc/retriever (verbose-error)$ retriever ls -v airports abalone-age
1. Dataset containing information on all airports on ouraiports.com
 airports
['airports', 'aeroplanes', 'airplanes', 'frequencies', 'runways', 'navaids', 'countries', 'regions']
Dataset containing information on all airports on ourairports.com
None
OurAirports.com, Megginson Technologies Ltd.

2. Abalone Age and Size Data
 abalone-age
[]
Database to aid in the prediction of the age of an Abalone given physical measurements
None
Lichman, M. (2013). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.
aakash01@aakash01-G3-3579:~/Desktop/gsoc/retriever (verbose-error)$ retriever ls -v a
Dataset(s) is not found.