We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Clean up CLI to use the python interface

In the python interface, we use the function [def datasets(keywords=None, licenses=None):](https://github.com/weecology/retriever/blob/bb06180a030d34eafa2e1ea13b74a3719df827e1/retriever/lib/datasets.py#L5).
This should be able to return what we are doing in the main (CLI interface) at [line](https://github.com/weecology/retriever/blob/main/retriever/__main__.py#L105).
 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_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `retriever/lib/get_opts.py`
Content:
```
1 import argparse
2 
3 import argcomplete
4 from argcomplete.completers import ChoicesCompleter
5 
6 from retriever.engines import engine_list
7 from retriever.lib.defaults import VERSION, RETRIEVER_REPOSITORY
8 from retriever.lib.scripts import SCRIPT_LIST, get_dataset_names_upstream
9 
10 module_list = SCRIPT_LIST()
11 script_list = []
12 keywords_list = []
13 licenses_list = []
14 
15 for module in module_list:
16     script_list.append(module.name)
17 
18     if hasattr(module, "keywords"):
19         # Add list of keywords to keywords_list
20         if module.keywords:
21             keywords_list += module.keywords
22 
23     if hasattr(module, "licenses"):
24         # Append string to list of licenses_list
25         if module.licenses:
26             for dict_items in module.licenses:
27                 if dict_items['name']:
28                     licenses_list.append(dict_items['name'])
29 
30 script_list.extend(get_dataset_names_upstream(repo=RETRIEVER_REPOSITORY))
31 script_list.extend(get_dataset_names_upstream())
32 script_list = sorted(set(script_list))
33 
34 # set of all possible licenses and keywords
35 licenses_options = set(licenses_list)
36 keywords_options = set(keywords_list)
37 
38 parser = argparse.ArgumentParser(prog="retriever")
39 parser.add_argument('-v', '--version', action='version', version=VERSION)
40 parser.add_argument('-q',
41                     '--quiet',
42                     help='suppress command-line output',
43                     action='store_true')
44 
45 # ..............................................................
46 # subparsers
47 # ..............................................................
48 
49 # retriever HELP
50 subparsers = parser.add_subparsers(help='sub-command help', dest='command')
51 
52 # retriever download/install/update/new help
53 download_parser = subparsers.add_parser('download',
54                                         help='download raw data files for a dataset')
55 install_parser = subparsers.add_parser('install', help='download and install dataset')
56 default_parser = subparsers.add_parser('defaults', help='displays default options')
57 update_parser = subparsers.add_parser('update',
58                                       help='download updated versions of scripts')
59 new_parser = subparsers.add_parser('new', help='create a new sample retriever script')
60 autocreate_parser = subparsers.add_parser(
61     'autocreate', help='CLI to automatically create retriever scripts')
62 ls_parser = subparsers.add_parser('ls',
63                                   help='display a list all available dataset scripts')
64 citation_parser = subparsers.add_parser('citation', help='view citation')
65 license_parser = subparsers.add_parser('license', help='view dataset license')
66 reset_parser = subparsers.add_parser(
67     'reset',
68     help='reset retriever: removes configuration settings, scripts, and cached data')
69 help_parser = subparsers.add_parser('help', help='')
70 commit_parser = subparsers.add_parser('commit', help='commit a dataset')
71 commit_log_parser = subparsers.add_parser('log', help='see log of a committed dataset')
72 
73 # ..............................................................
74 # subparsers with Arguments
75 # ..............................................................
76 
77 citation_parser.add_argument('dataset',
78                              help='dataset name',
79                              nargs='?',
80                              default=None,
81                              choices=script_list + [None])
82 commit_parser.add_argument('dataset', help='dataset name', choices=script_list)
83 commit_parser.add_argument('-p',
84                            '--path',
85                            help='path to store committed file',
86                            default=None,
87                            required=False)
88 commit_parser.add_argument('-m',
89                            '--message',
90                            help='commit message',
91                            default=None,
92                            required=True,
93                            type=str)
94 commit_log_parser.add_argument('dataset', help='dataset name', choices=script_list)
95 license_parser.add_argument('dataset',
96                             help='dataset name',
97                             nargs='?',
98                             default=None,
99                             choices=script_list + [None])
100 new_parser.add_argument('filename', help='new script filename')
101 reset_parser.add_argument('scope', help='things to reset: all, scripts or data').completer = \
102     ChoicesCompleter(script_list + ['all', 'scripts', 'data'])
103 install_parser.add_argument('--compile',
104                             help='force re-compile of script before downloading',
105                             action='store_true')
106 install_parser.add_argument('--debug', help='run in debug mode', action='store_true')
107 install_parser.add_argument('--not-cached',
108                             help='overwrites local cache of raw data',
109                             action='store_true')
110 download_parser.add_argument('--debug', help='run in debug mode', action='store_true')
111 download_parser.add_argument('--not-cached',
112                              help='overwrites local cache of raw data',
113                              action='store_true')
114 download_parser.add_argument('-b',
115                              '--bbox',
116                              nargs=4,
117                              help='Set bounding box xmin, ymin, xmax, ymax',
118                              required=False)
119 
120 ls_parser.add_argument('-l', help='search datasets with specific license(s)',
121                        nargs='+').completer = ChoicesCompleter(list(licenses_options))
122 ls_parser.add_argument('-k', help='search datasets with keyword(s)',
123                        nargs='+').completer = ChoicesCompleter(list(keywords_options))
124 ls_parser.add_argument('-v',
125                        help='verbose list of all datasets',
126                        nargs='*',
127                        default=False)
128 
129 autocreate_parser.add_argument('path', help='path to the data file(s)')
130 autocreate_parser.add_argument('-dt',
131                                help='datatype for files',
132                                nargs='?',
133                                default='tabular',
134                                choices=['raster', 'vector', 'tabular'])
135 autocreate_parser.add_argument('-d',
136                                help='turn a directory and subdirectories into scripts',
137                                action='store_true')
138 autocreate_parser.add_argument('-e',
139                                help='encoding of the source file',
140                                nargs='?',
141                                default='utf-8')
142 autocreate_parser.add_argument('-f', help='turn files into scripts', action='store_true')
143 autocreate_parser.add_argument('-o',
144                                help='write scripts out to a designated directory',
145                                nargs='?',
146                                const='')
147 autocreate_parser.add_argument('--skip-lines',
148                                help='skip a set number of lines before processing data',
149                                nargs=1,
150                                type=int)
151 # retriever Install {Engine} ..
152 # retriever download [options]
153 install_subparsers = install_parser.add_subparsers(help='engine-specific help',
154                                                    dest='engine')
155 
156 for engine in engine_list:
157     if engine.name == "Download Only":
158         # download engine follows, retriever download [dataset]
159         download_parser.add_argument(
160             'dataset', help='dataset name').completer = ChoicesCompleter(script_list)
161     else:
162         engine_parser = install_subparsers.add_parser(engine.abbreviation,
163                                                       help=engine.name)
164         engine_parser.add_argument(
165             'dataset', help='dataset name').completer = ChoicesCompleter(script_list)
166         engine_parser.add_argument(
167             '--hash-value',
168             help='install dataset from provenance directory using hash value',
169             default=None,
170             required=False,
171             type=str)
172         engine_parser.add_argument('-b',
173                                    '--bbox',
174                                    nargs=4,
175                                    help='Set bounding box xmin, ymin, xmax, ymax',
176                                    required=False)
177         if engine.name == "JSON":
178             engine_parser.add_argument('-p',
179                                        '--pretty',
180                                        help='Add indentation to json file',
181                                        action='store_true',
182                                        required=False)
183 
184     abbreviations = set('h')
185 
186     for arg in engine.required_opts:
187         arg_name, help_msg, default = arg[:3]
188         potential_abbreviations = [char for char in arg_name if char not in abbreviations]
189         if potential_abbreviations:
190             abbreviation = potential_abbreviations[0]
191             abbreviations.add(abbreviation)
192         else:
193             abbreviation = '-%s' % arg_name
194 
195         if engine.name == "Download Only" or abbreviation == "download":
196             # add attributes to Download only engine
197             download_parser.add_argument('--%s' % arg_name,
198                                          '-%s' % abbreviation,
199                                          help=help_msg,
200                                          nargs='?',
201                                          default=default)
202         else:
203             engine_parser.add_argument('--%s' % arg_name,
204                                        '-%s' % abbreviation,
205                                        help=help_msg,
206                                        nargs='?',
207                                        default=default)
208 
209 argcomplete.autocomplete(parser)
210
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/retriever/lib/get_opts.py b/retriever/lib/get_opts.py
--- a/retriever/lib/get_opts.py
+++ b/retriever/lib/get_opts.py
@@ -31,9 +31,10 @@
 script_list.extend(get_dataset_names_upstream())
 script_list = sorted(set(script_list))
 
-# set of all possible licenses and keywords
+# set of all possible licenses, keywords and scripts
 licenses_options = set(licenses_list)
 keywords_options = set(keywords_list)
+scripts_options = script_list
 
 parser = argparse.ArgumentParser(prog="retriever")
 parser.add_argument('-v', '--version', action='version', version=VERSION)
@@ -121,10 +122,8 @@
                        nargs='+').completer = ChoicesCompleter(list(licenses_options))
 ls_parser.add_argument('-k', help='search datasets with keyword(s)',
                        nargs='+').completer = ChoicesCompleter(list(keywords_options))
-ls_parser.add_argument('-v',
-                       help='verbose list of all datasets',
-                       nargs='*',
-                       default=False)
+ls_parser.add_argument('-v', help='verbose list of specified dataset(s)',
+                       nargs='+').completer = ChoicesCompleter(list(scripts_options))
 
 autocreate_parser.add_argument('path', help='path to the data file(s)')
 autocreate_parser.add_argument('-dt',

{"golden_diff": "diff --git a/retriever/lib/get_opts.py b/retriever/lib/get_opts.py\n--- a/retriever/lib/get_opts.py\n+++ b/retriever/lib/get_opts.py\n@@ -31,9 +31,10 @@\n script_list.extend(get_dataset_names_upstream())\n script_list = sorted(set(script_list))\n \n-# set of all possible licenses and keywords\n+# set of all possible licenses, keywords and scripts\n licenses_options = set(licenses_list)\n keywords_options = set(keywords_list)\n+scripts_options = script_list\n \n parser = argparse.ArgumentParser(prog=\"retriever\")\n parser.add_argument('-v', '--version', action='version', version=VERSION)\n@@ -121,10 +122,8 @@\n                        nargs='+').completer = ChoicesCompleter(list(licenses_options))\n ls_parser.add_argument('-k', help='search datasets with keyword(s)',\n                        nargs='+').completer = ChoicesCompleter(list(keywords_options))\n-ls_parser.add_argument('-v',\n-                       help='verbose list of all datasets',\n-                       nargs='*',\n-                       default=False)\n+ls_parser.add_argument('-v', help='verbose list of specified dataset(s)',\n+                       nargs='+').completer = ChoicesCompleter(list(scripts_options))\n \n autocreate_parser.add_argument('path', help='path to the data file(s)')\n autocreate_parser.add_argument('-dt',\n", "issue": "Clean up CLI to use the python interface\n\r\nIn the python interface, we use the function [def datasets(keywords=None, licenses=None):](https://github.com/weecology/retriever/blob/bb06180a030d34eafa2e1ea13b74a3719df827e1/retriever/lib/datasets.py#L5).\r\nThis should be able to return what we are doing in the main (CLI interface) at [line](https://github.com/weecology/retriever/blob/main/retriever/__main__.py#L105).\r\n and the results can be printed in the away that looks good in CLI(terminal)\r\n\r\n_Originally posted by @henrykironde in https://github.com/weecology/retriever/issues/1570#issuecomment-810558636_\n", "before_files": [{"content": "import argparse\n\nimport argcomplete\nfrom argcomplete.completers import ChoicesCompleter\n\nfrom retriever.engines import engine_list\nfrom retriever.lib.defaults import VERSION, RETRIEVER_REPOSITORY\nfrom retriever.lib.scripts import SCRIPT_LIST, get_dataset_names_upstream\n\nmodule_list = SCRIPT_LIST()\nscript_list = []\nkeywords_list = []\nlicenses_list = []\n\nfor module in module_list:\n    script_list.append(module.name)\n\n    if hasattr(module, \"keywords\"):\n        # Add list of keywords to keywords_list\n        if module.keywords:\n            keywords_list += module.keywords\n\n    if hasattr(module, \"licenses\"):\n        # Append string to list of licenses_list\n        if module.licenses:\n            for dict_items in module.licenses:\n                if dict_items['name']:\n                    licenses_list.append(dict_items['name'])\n\nscript_list.extend(get_dataset_names_upstream(repo=RETRIEVER_REPOSITORY))\nscript_list.extend(get_dataset_names_upstream())\nscript_list = sorted(set(script_list))\n\n# set of all possible licenses and keywords\nlicenses_options = set(licenses_list)\nkeywords_options = set(keywords_list)\n\nparser = argparse.ArgumentParser(prog=\"retriever\")\nparser.add_argument('-v', '--version', action='version', version=VERSION)\nparser.add_argument('-q',\n                    '--quiet',\n                    help='suppress command-line output',\n                    action='store_true')\n\n# ..............................................................\n# subparsers\n# ..............................................................\n\n# retriever HELP\nsubparsers = parser.add_subparsers(help='sub-command help', dest='command')\n\n# retriever download/install/update/new help\ndownload_parser = subparsers.add_parser('download',\n                                        help='download raw data files for a dataset')\ninstall_parser = subparsers.add_parser('install', help='download and install dataset')\ndefault_parser = subparsers.add_parser('defaults', help='displays default options')\nupdate_parser = subparsers.add_parser('update',\n                                      help='download updated versions of scripts')\nnew_parser = subparsers.add_parser('new', help='create a new sample retriever script')\nautocreate_parser = subparsers.add_parser(\n    'autocreate', help='CLI to automatically create retriever scripts')\nls_parser = subparsers.add_parser('ls',\n                                  help='display a list all available dataset scripts')\ncitation_parser = subparsers.add_parser('citation', help='view citation')\nlicense_parser = subparsers.add_parser('license', help='view dataset license')\nreset_parser = subparsers.add_parser(\n    'reset',\n    help='reset retriever: removes configuration settings, scripts, and cached data')\nhelp_parser = subparsers.add_parser('help', help='')\ncommit_parser = subparsers.add_parser('commit', help='commit a dataset')\ncommit_log_parser = subparsers.add_parser('log', help='see log of a committed dataset')\n\n# ..............................................................\n# subparsers with Arguments\n# ..............................................................\n\ncitation_parser.add_argument('dataset',\n                             help='dataset name',\n                             nargs='?',\n                             default=None,\n                             choices=script_list + [None])\ncommit_parser.add_argument('dataset', help='dataset name', choices=script_list)\ncommit_parser.add_argument('-p',\n                           '--path',\n                           help='path to store committed file',\n                           default=None,\n                           required=False)\ncommit_parser.add_argument('-m',\n                           '--message',\n                           help='commit message',\n                           default=None,\n                           required=True,\n                           type=str)\ncommit_log_parser.add_argument('dataset', help='dataset name', choices=script_list)\nlicense_parser.add_argument('dataset',\n                            help='dataset name',\n                            nargs='?',\n                            default=None,\n                            choices=script_list + [None])\nnew_parser.add_argument('filename', help='new script filename')\nreset_parser.add_argument('scope', help='things to reset: all, scripts or data').completer = \\\n    ChoicesCompleter(script_list + ['all', 'scripts', 'data'])\ninstall_parser.add_argument('--compile',\n                            help='force re-compile of script before downloading',\n                            action='store_true')\ninstall_parser.add_argument('--debug', help='run in debug mode', action='store_true')\ninstall_parser.add_argument('--not-cached',\n                            help='overwrites local cache of raw data',\n                            action='store_true')\ndownload_parser.add_argument('--debug', help='run in debug mode', action='store_true')\ndownload_parser.add_argument('--not-cached',\n                             help='overwrites local cache of raw data',\n                             action='store_true')\ndownload_parser.add_argument('-b',\n                             '--bbox',\n                             nargs=4,\n                             help='Set bounding box xmin, ymin, xmax, ymax',\n                             required=False)\n\nls_parser.add_argument('-l', help='search datasets with specific license(s)',\n                       nargs='+').completer = ChoicesCompleter(list(licenses_options))\nls_parser.add_argument('-k', help='search datasets with keyword(s)',\n                       nargs='+').completer = ChoicesCompleter(list(keywords_options))\nls_parser.add_argument('-v',\n                       help='verbose list of all datasets',\n                       nargs='*',\n                       default=False)\n\nautocreate_parser.add_argument('path', help='path to the data file(s)')\nautocreate_parser.add_argument('-dt',\n                               help='datatype for files',\n                               nargs='?',\n                               default='tabular',\n                               choices=['raster', 'vector', 'tabular'])\nautocreate_parser.add_argument('-d',\n                               help='turn a directory and subdirectories into scripts',\n                               action='store_true')\nautocreate_parser.add_argument('-e',\n                               help='encoding of the source file',\n                               nargs='?',\n                               default='utf-8')\nautocreate_parser.add_argument('-f', help='turn files into scripts', action='store_true')\nautocreate_parser.add_argument('-o',\n                               help='write scripts out to a designated directory',\n                               nargs='?',\n                               const='')\nautocreate_parser.add_argument('--skip-lines',\n                               help='skip a set number of lines before processing data',\n                               nargs=1,\n                               type=int)\n# retriever Install {Engine} ..\n# retriever download [options]\ninstall_subparsers = install_parser.add_subparsers(help='engine-specific help',\n                                                   dest='engine')\n\nfor engine in engine_list:\n    if engine.name == \"Download Only\":\n        # download engine follows, retriever download [dataset]\n        download_parser.add_argument(\n            'dataset', help='dataset name').completer = ChoicesCompleter(script_list)\n    else:\n        engine_parser = install_subparsers.add_parser(engine.abbreviation,\n                                                      help=engine.name)\n        engine_parser.add_argument(\n            'dataset', help='dataset name').completer = ChoicesCompleter(script_list)\n        engine_parser.add_argument(\n            '--hash-value',\n            help='install dataset from provenance directory using hash value',\n            default=None,\n            required=False,\n            type=str)\n        engine_parser.add_argument('-b',\n                                   '--bbox',\n                                   nargs=4,\n                                   help='Set bounding box xmin, ymin, xmax, ymax',\n                                   required=False)\n        if engine.name == \"JSON\":\n            engine_parser.add_argument('-p',\n                                       '--pretty',\n                                       help='Add indentation to json file',\n                                       action='store_true',\n                                       required=False)\n\n    abbreviations = set('h')\n\n    for arg in engine.required_opts:\n        arg_name, help_msg, default = arg[:3]\n        potential_abbreviations = [char for char in arg_name if char not in abbreviations]\n        if potential_abbreviations:\n            abbreviation = potential_abbreviations[0]\n            abbreviations.add(abbreviation)\n        else:\n            abbreviation = '-%s' % arg_name\n\n        if engine.name == \"Download Only\" or abbreviation == \"download\":\n            # add attributes to Download only engine\n            download_parser.add_argument('--%s' % arg_name,\n                                         '-%s' % abbreviation,\n                                         help=help_msg,\n                                         nargs='?',\n                                         default=default)\n        else:\n            engine_parser.add_argument('--%s' % arg_name,\n                                       '-%s' % abbreviation,\n                                       help=help_msg,\n                                       nargs='?',\n                                       default=default)\n\nargcomplete.autocomplete(parser)\n", "path": "retriever/lib/get_opts.py"}], "after_files": [{"content": "import argparse\n\nimport argcomplete\nfrom argcomplete.completers import ChoicesCompleter\n\nfrom retriever.engines import engine_list\nfrom retriever.lib.defaults import VERSION, RETRIEVER_REPOSITORY\nfrom retriever.lib.scripts import SCRIPT_LIST, get_dataset_names_upstream\n\nmodule_list = SCRIPT_LIST()\nscript_list = []\nkeywords_list = []\nlicenses_list = []\n\nfor module in module_list:\n    script_list.append(module.name)\n\n    if hasattr(module, \"keywords\"):\n        # Add list of keywords to keywords_list\n        if module.keywords:\n            keywords_list += module.keywords\n\n    if hasattr(module, \"licenses\"):\n        # Append string to list of licenses_list\n        if module.licenses:\n            for dict_items in module.licenses:\n                if dict_items['name']:\n                    licenses_list.append(dict_items['name'])\n\nscript_list.extend(get_dataset_names_upstream(repo=RETRIEVER_REPOSITORY))\nscript_list.extend(get_dataset_names_upstream())\nscript_list = sorted(set(script_list))\n\n# set of all possible licenses, keywords and scripts\nlicenses_options = set(licenses_list)\nkeywords_options = set(keywords_list)\nscripts_options = script_list\n\nparser = argparse.ArgumentParser(prog=\"retriever\")\nparser.add_argument('-v', '--version', action='version', version=VERSION)\nparser.add_argument('-q',\n                    '--quiet',\n                    help='suppress command-line output',\n                    action='store_true')\n\n# ..............................................................\n# subparsers\n# ..............................................................\n\n# retriever HELP\nsubparsers = parser.add_subparsers(help='sub-command help', dest='command')\n\n# retriever download/install/update/new help\ndownload_parser = subparsers.add_parser('download',\n                                        help='download raw data files for a dataset')\ninstall_parser = subparsers.add_parser('install', help='download and install dataset')\ndefault_parser = subparsers.add_parser('defaults', help='displays default options')\nupdate_parser = subparsers.add_parser('update',\n                                      help='download updated versions of scripts')\nnew_parser = subparsers.add_parser('new', help='create a new sample retriever script')\nautocreate_parser = subparsers.add_parser(\n    'autocreate', help='CLI to automatically create retriever scripts')\nls_parser = subparsers.add_parser('ls',\n                                  help='display a list all available dataset scripts')\ncitation_parser = subparsers.add_parser('citation', help='view citation')\nlicense_parser = subparsers.add_parser('license', help='view dataset license')\nreset_parser = subparsers.add_parser(\n    'reset',\n    help='reset retriever: removes configuration settings, scripts, and cached data')\nhelp_parser = subparsers.add_parser('help', help='')\ncommit_parser = subparsers.add_parser('commit', help='commit a dataset')\ncommit_log_parser = subparsers.add_parser('log', help='see log of a committed dataset')\n\n# ..............................................................\n# subparsers with Arguments\n# ..............................................................\n\ncitation_parser.add_argument('dataset',\n                             help='dataset name',\n                             nargs='?',\n                             default=None,\n                             choices=script_list + [None])\ncommit_parser.add_argument('dataset', help='dataset name', choices=script_list)\ncommit_parser.add_argument('-p',\n                           '--path',\n                           help='path to store committed file',\n                           default=None,\n                           required=False)\ncommit_parser.add_argument('-m',\n                           '--message',\n                           help='commit message',\n                           default=None,\n                           required=True,\n                           type=str)\ncommit_log_parser.add_argument('dataset', help='dataset name', choices=script_list)\nlicense_parser.add_argument('dataset',\n                            help='dataset name',\n                            nargs='?',\n                            default=None,\n                            choices=script_list + [None])\nnew_parser.add_argument('filename', help='new script filename')\nreset_parser.add_argument('scope', help='things to reset: all, scripts or data').completer = \\\n    ChoicesCompleter(script_list + ['all', 'scripts', 'data'])\ninstall_parser.add_argument('--compile',\n                            help='force re-compile of script before downloading',\n                            action='store_true')\ninstall_parser.add_argument('--debug', help='run in debug mode', action='store_true')\ninstall_parser.add_argument('--not-cached',\n                            help='overwrites local cache of raw data',\n                            action='store_true')\ndownload_parser.add_argument('--debug', help='run in debug mode', action='store_true')\ndownload_parser.add_argument('--not-cached',\n                             help='overwrites local cache of raw data',\n                             action='store_true')\ndownload_parser.add_argument('-b',\n                             '--bbox',\n                             nargs=4,\n                             help='Set bounding box xmin, ymin, xmax, ymax',\n                             required=False)\n\nls_parser.add_argument('-l', help='search datasets with specific license(s)',\n                       nargs='+').completer = ChoicesCompleter(list(licenses_options))\nls_parser.add_argument('-k', help='search datasets with keyword(s)',\n                       nargs='+').completer = ChoicesCompleter(list(keywords_options))\nls_parser.add_argument('-v', help='verbose list of specified dataset(s)',\n                       nargs='+').completer = ChoicesCompleter(list(scripts_options))\n\nautocreate_parser.add_argument('path', help='path to the data file(s)')\nautocreate_parser.add_argument('-dt',\n                               help='datatype for files',\n                               nargs='?',\n                               default='tabular',\n                               choices=['raster', 'vector', 'tabular'])\nautocreate_parser.add_argument('-d',\n                               help='turn a directory and subdirectories into scripts',\n                               action='store_true')\nautocreate_parser.add_argument('-e',\n                               help='encoding of the source file',\n                               nargs='?',\n                               default='utf-8')\nautocreate_parser.add_argument('-f', help='turn files into scripts', action='store_true')\nautocreate_parser.add_argument('-o',\n                               help='write scripts out to a designated directory',\n                               nargs='?',\n                               const='')\nautocreate_parser.add_argument('--skip-lines',\n                               help='skip a set number of lines before processing data',\n                               nargs=1,\n                               type=int)\n# retriever Install {Engine} ..\n# retriever download [options]\ninstall_subparsers = install_parser.add_subparsers(help='engine-specific help',\n                                                   dest='engine')\n\nfor engine in engine_list:\n    if engine.name == \"Download Only\":\n        # download engine follows, retriever download [dataset]\n        download_parser.add_argument(\n            'dataset', help='dataset name').completer = ChoicesCompleter(script_list)\n    else:\n        engine_parser = install_subparsers.add_parser(engine.abbreviation,\n                                                      help=engine.name)\n        engine_parser.add_argument(\n            'dataset', help='dataset name').completer = ChoicesCompleter(script_list)\n        engine_parser.add_argument(\n            '--hash-value',\n            help='install dataset from provenance directory using hash value',\n            default=None,\n            required=False,\n            type=str)\n        engine_parser.add_argument('-b',\n                                   '--bbox',\n                                   nargs=4,\n                                   help='Set bounding box xmin, ymin, xmax, ymax',\n                                   required=False)\n        if engine.name == \"JSON\":\n            engine_parser.add_argument('-p',\n                                       '--pretty',\n                                       help='Add indentation to json file',\n                                       action='store_true',\n                                       required=False)\n\n    abbreviations = set('h')\n\n    for arg in engine.required_opts:\n        arg_name, help_msg, default = arg[:3]\n        potential_abbreviations = [char for char in arg_name if char not in abbreviations]\n        if potential_abbreviations:\n            abbreviation = potential_abbreviations[0]\n            abbreviations.add(abbreviation)\n        else:\n            abbreviation = '-%s' % arg_name\n\n        if engine.name == \"Download Only\" or abbreviation == \"download\":\n            # add attributes to Download only engine\n            download_parser.add_argument('--%s' % arg_name,\n                                         '-%s' % abbreviation,\n                                         help=help_msg,\n                                         nargs='?',\n                                         default=default)\n        else:\n            engine_parser.add_argument('--%s' % arg_name,\n                                       '-%s' % abbreviation,\n                                       help=help_msg,\n                                       nargs='?',\n                                       default=default)\n\nargcomplete.autocomplete(parser)\n", "path": "retriever/lib/get_opts.py"}]}