diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2020-10-11 13:38:31 +0200 |
---|---|---|
committer | Nejc Habjan <nejc.habjan@siemens.com> | 2020-10-11 14:13:09 +0200 |
commit | 6c21fc83d3d6173bffb60e686ec579f875f8bebe (patch) | |
tree | 4e5e41c42257bc3e075eafc5969062f6fe136fc3 | |
parent | 68a41629ca0c27bd62d8e656071f612d443aaa1b (diff) | |
download | gitlab-docs/cli-reference-page.tar.gz |
docs(cli): add auto-generated CLI referencedocs/cli-reference-page
-rw-r--r-- | docs/api/gitlab.rst | 4 | ||||
-rw-r--r-- | docs/cli-objects.rst | 17 | ||||
-rw-r--r-- | docs/cli-usage.rst (renamed from docs/cli.rst) | 4 | ||||
-rw-r--r-- | docs/conf.py | 7 | ||||
-rw-r--r-- | docs/index.rst | 5 | ||||
-rw-r--r-- | gitlab/cli.py | 14 | ||||
-rw-r--r-- | rtd-requirements.txt | 2 | ||||
-rw-r--r-- | test-requirements.txt | 3 | ||||
-rw-r--r-- | tox.ini | 1 |
9 files changed, 49 insertions, 8 deletions
diff --git a/docs/api/gitlab.rst b/docs/api/gitlab.rst index 1dabad2..0377b87 100644 --- a/docs/api/gitlab.rst +++ b/docs/api/gitlab.rst @@ -1,5 +1,5 @@ -gitlab package -============== +API reference (``gitlab`` package) +================================== Subpackages ----------- diff --git a/docs/cli-objects.rst b/docs/cli-objects.rst new file mode 100644 index 0000000..d6648f6 --- /dev/null +++ b/docs/cli-objects.rst @@ -0,0 +1,17 @@ +################################## +CLI reference (``gitlab`` command) +################################## + +.. warning:: + + The following is a complete, auto-generated list of subcommands available + via the :command:`gitlab` command-line tool. Some of the actions may + currently not work as expected or lack functionality available via the API. + + Please see the existing `list of CLI related issues`_, or open a new one if + it is not already listed there. + +.. _list of CLI related issues: https://github.com/python-gitlab/python-gitlab/issues?q=is%3Aopen+is%3Aissue+label%3Acli + +.. autoprogram:: gitlab.cli:docs() + :prog: gitlab diff --git a/docs/cli.rst b/docs/cli-usage.rst index 95f7062..10fd73a 100644 --- a/docs/cli.rst +++ b/docs/cli-usage.rst @@ -180,6 +180,10 @@ Example: Examples ======== + **Notice:** + + For a complete list of objects and actions available, see :doc:`/cli-objects`. + List the projects (paginated): .. code-block:: console diff --git a/docs/conf.py b/docs/conf.py index a5e5406..681af22 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -39,7 +39,12 @@ sys.path.insert(0, os.path.abspath("..")) # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ["sphinx.ext.autodoc", "sphinx.ext.autosummary", "ext.docstrings"] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "ext.docstrings", + "sphinxcontrib.autoprogram", +] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/index.rst b/docs/index.rst index 9c8cfd3..22f4c9a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,14 +12,15 @@ Contents: :maxdepth: 2 install - cli + cli-usage api-usage faq - switching-to-v4 api-objects api/gitlab + cli-objects release_notes changelog + switching-to-v4 Indices and tables diff --git a/gitlab/cli.py b/gitlab/cli.py index d356d16..ff98a4f 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -149,6 +149,20 @@ def _parse_value(v): return v +def docs(): + """ + Provide a statically generated parser for sphinx only, so we don't need + to provide dummy gitlab config for readthedocs. + """ + if "sphinx" not in sys.modules: + sys.exit("Docs parser is only intended for build_sphinx") + + parser = _get_base_parser(add_help=False) + cli_module = importlib.import_module("gitlab.v4.cli") + + return _get_parser(cli_module) + + def main(): if "--version" in sys.argv: print(gitlab.__version__) diff --git a/rtd-requirements.txt b/rtd-requirements.txt index 41c10ba..a91dd8f 100644 --- a/rtd-requirements.txt +++ b/rtd-requirements.txt @@ -1,3 +1,5 @@ -r requirements.txt jinja2 sphinx==3.2.1 +sphinx_rtd_theme +sphinxcontrib-autoprogram diff --git a/test-requirements.txt b/test-requirements.txt index 94890f9..8d61ad1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,9 +1,6 @@ coverage httmock -jinja2 mock pytest pytest-cov -sphinx==3.2.1 -sphinx_rtd_theme responses @@ -44,6 +44,7 @@ max-line-length = 88 ignore = H501,H803 [testenv:docs] +deps = -r{toxinidir}/rtd-requirements.txt commands = python setup.py build_sphinx [testenv:cover] |