Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Auto-inject CLI help into user doc #3286

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
# Thus, any C-extensions that are needed to build the documentation will *not*
# be accessible, and the documentation will not build correctly.

import datetime
import subprocess
import sys
import datetime

from docutils import nodes
from sphinx.util.docutils import SphinxDirective

from jdaviz import __version__

Expand Down Expand Up @@ -293,3 +296,17 @@

# Options for linkcheck
linkcheck_ignore = ['https://github.com/spacetelescope/jdaviz/settings/branches']


# -- Custom directive -------------------------------------------

class JdavizCLIHelpDirective(SphinxDirective):

def run(self):
help_text = subprocess.check_output(["jdaviz", "--help"], encoding="utf-8")
paragraph_node = nodes.literal_block(text=help_text)
return [paragraph_node]


def setup(app):
app.add_directive('jdavizclihelp', JdavizCLIHelpDirective)
2 changes: 2 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ To see the syntax and usage, from a terminal, type::

jdaviz --help

.. jdavizclihelp::

Typical usage to load a file into a desired configuration::

jdaviz --layout=[imviz|specviz|cubeviz|mosviz|specviz2d] /path/to/data/file
Expand Down