| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,6 +54,13 @@ Documentation | |||
| 54 | 54 | The full documentation for CLI and API is available on `readthedocs | |
| 55 | 55 | <http://python-gitlab.readthedocs.org/en/stable/>`_. | |
| 56 | 56 | ||
| 57 | + Build the docs | ||
| 58 | + -------------- | ||
| 59 | + You can build the documentation using ``sphinx``:: | ||
| 60 | + | ||
| 61 | + pip install sphinx | ||
| 62 | + python setup.py build_sphinx | ||
| 63 | + | ||
| 57 | 64 | ||
| 58 | 65 | Contributing | |
| 59 | 66 | ============ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -157,6 +157,11 @@ These options must be defined before the mandatory arguments. | |||
| 157 | 157 | ``--output``, ``-o`` | |
| 158 | 158 | Output format. Defaults to a custom format. Can also be ``yaml`` or ``json``. | |
| 159 | 159 | ||
| 160 | + **Notice:** | ||
| 161 | + | ||
| 162 | + The `PyYAML package <https://pypi.org/project/PyYAML/>`_ is required to use the yaml output option. | ||
| 163 | + You need to install it separately using ``pip install PyYAML`` | ||
| 164 | + | ||
| 160 | 165 | ``--fields``, ``-f`` | |
| 161 | 166 | Comma-separated list of fields to display (``yaml`` and ``json`` output | |
| 162 | 167 | formats only). If not used, all the object fields are displayed. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -302,14 +302,24 @@ def display_list(self, data, fields, **kwargs): | |||
| 302 | 302 | ||
| 303 | 303 | class YAMLPrinter(object): | |
| 304 | 304 | def display(self, d, **kwargs): | |
| 305 | - import yaml # noqa | ||
| 306 | - print(yaml.safe_dump(d, default_flow_style=False)) | ||
| 305 | + try: | ||
| 306 | + import yaml # noqa | ||
| 307 | + print(yaml.safe_dump(d, default_flow_style=False)) | ||
| 308 | + except ImportError: | ||
| 309 | + exit("PyYaml is not installed.\n" | ||
| 310 | + "Install it with `pip install PyYaml` " | ||
| 311 | + "to use the yaml output feature") | ||
| 307 | 312 | ||
| 308 | 313 | def display_list(self, data, fields, **kwargs): | |
| 309 | - import yaml # noqa | ||
| 310 | - print(yaml.safe_dump( | ||
| 311 | - [get_dict(obj, fields) for obj in data], | ||
| 312 | - default_flow_style=False)) | ||
| 314 | + try: | ||
| 315 | + import yaml # noqa | ||
| 316 | + print(yaml.safe_dump( | ||
| 317 | + [get_dict(obj, fields) for obj in data], | ||
| 318 | + default_flow_style=False)) | ||
| 319 | + except ImportError: | ||
| 320 | + exit("PyYaml is not installed.\n" | ||
| 321 | + "Install it with `pip install PyYaml` " | ||
| 322 | + "to use the yaml output feature") | ||
| 313 | 323 | ||
| 314 | 324 | ||
| 315 | 325 | class LegacyPrinter(object): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments