Change in pysim[master]: docs/shell.rst: Auto-generate shell command reference

laforge gerrit-no-reply at lists.osmocom.org
Tue Apr 6 19:33:15 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/23606 )

Change subject: docs/shell.rst: Auto-generate shell command reference
......................................................................

docs/shell.rst: Auto-generate shell command reference

We use a slightly modified version of sphinx-argparse
(with patch https://github.com/alex-rudakov/sphinx-argparse/pull/136 applied)
in order to generate the command reference for each shell command in the
manual.

As the upstream repository seems unmaintained for ~2 years, let's use
the osmocom 'fork' with that above-mentioned patch applied.

Change-Id: I134f267cf53c7ecbc8cbfb33a8766d63bf4a8582
---
M contrib/jenkins.sh
M docs/conf.py
M docs/shell.rst
3 files changed, 58 insertions(+), 21 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index efb913e..60061e3 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -21,6 +21,7 @@
 # attempt to build documentation
 pip install sphinx
 pip install sphinxcontrib-napoleon
+pip3 install -e 'git+https://github.com/osmocom/sphinx-argparse@master#egg=sphinx-argparse'
 (cd docs && make html)
 
 # run the test with physical cards
diff --git a/docs/conf.py b/docs/conf.py
index add26d8..2117172 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -29,6 +29,7 @@
 # ones.
 extensions = [
         "sphinx.ext.autodoc",
+        "sphinxarg.ext",
         "sphinx.ext.autosectionlabel",
         "sphinx.ext.napoleon"
 ]
diff --git a/docs/shell.rst b/docs/shell.rst
index ddb21d5..2edebbf 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -85,32 +85,41 @@
 
 change_chv
 ~~~~~~~~~~
-
-This command allows you to change a CHV (PIN).
+.. argparse::
+   :module: pySim-shell
+   :func: Iso7816Commands.change_chv_parser
 
 
 disable_chv
 ~~~~~~~~~~~
+.. argparse::
+   :module: pySim-shell
+   :func: Iso7816Commands.disable_chv_parser
 
-This command allows you to disable a CHV (PIN).
 
 enable_chv
 ~~~~~~~~~~
-
-This command allows you to enable a CHV (PIN).
+.. argparse::
+   :module: pySim-shell
+   :func: Iso7816Commands.enable_chv_parser
 
 
 unblock_chv
 ~~~~~~~~~~~
+.. argparse::
+   :module: pySim-shell
+   :func: Iso7816Commands.unblock_chv_parser
 
-This command allows you to unblock a CHV (PIN) using the PUK.
 
 verify_chv
 ~~~~~~~~~~
-
 This command allows you to verify a CHV (PIN), which is how the specifications call
 it if you authenticate yourself with the said CHV/PIN.
 
+.. argparse::
+   :module: pySim-shell
+   :func: Iso7816Commands.verify_chv_parser
+
 
 
 pySim commands
@@ -128,30 +137,26 @@
 
 dir
 ~~~
-
-::
-
-  usage: dir [-h] [--fids] [--names] [--apps] [--all]
-
-  Show a listing of files available in currently selected DF or MF
-
-  optional arguments:
-    -h, --help  show this help message and exit
-    --fids      Show file identifiers
-    --names     Show file names
-    --apps      Show applications
-    --all       Show all selectable identifiers and names
+.. argparse::
+   :module: pySim-shell
+   :func: PySimCommands.dir_parser
 
 
 export
 ~~~~~~
+.. argparse::
+   :module: pySim-shell
+   :func: PySimCommands.export_parser
+
 
 tree
 ~~~~
+FIXME
+
 
 verify_adm
 ~~~~~~~~~~
-
+FIXME
 
 
 Linear Fixed EF commands
@@ -161,15 +166,30 @@
 
 read_record
 ~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: LinFixedEF.ShellCommands.read_rec_parser
+
 
 read_record_decoded
 ~~~~~~~~~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: LinFixedEF.ShellCommands.read_rec_dec_parser
+
 
 update_record
 ~~~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: LinFixedEF.ShellCommands.upd_rec_parser
+
 
 update_record_decoded
 ~~~~~~~~~~~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: LinFixedEF.ShellCommands.upd_rec_dec_parser
 
 
 
@@ -181,15 +201,30 @@
 
 read_binary
 ~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: TransparentEF.ShellCommands.read_bin_parser
+
 
 read_binary_decoded
 ~~~~~~~~~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: TransparentEF.ShellCommands.read_bin_dec_parser
+
 
 update_binary
 ~~~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: TransparentEF.ShellCommands.upd_bin_parser
+
 
 update_binary_decoded
 ~~~~~~~~~~~~~~~~~~~~~
+.. argparse::
+   :module: pySim.filesystem
+   :func: TransparentEF.ShellCommands.upd_bin_dec_parser
 
 
 

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/23606
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I134f267cf53c7ecbc8cbfb33a8766d63bf4a8582
Gerrit-Change-Number: 23606
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210406/1015b075/attachment.htm>


More information about the gerrit-log mailing list