weecology / retriever

Quickly download, clean up, and install public datasets into a database management system
http://data-retriever.org
Other
306 stars 132 forks source link

Clean up CLI to use the python interface #1572

Closed henrykironde closed 3 years ago

henrykironde commented 3 years ago

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 https://github.com/weecology/retriever/issues/1570#issuecomment-810558636

henrykironde commented 3 years ago

@Aakash3101

Aakash3101 commented 3 years ago

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?

henrykironde commented 3 years ago

Yes

Aakash3101 commented 3 years ago

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

Aakash3101 commented 3 years ago

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.