Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
lucc committed Dec 20, 2024
1 parent 794a0e9 commit 01bb87a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 1 deletion.
9 changes: 9 additions & 0 deletions doc/source/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,12 @@ Remove contact:
.. |khard.conf| replace:: :manpage:`khard.conf`
.. _khard.conf: man/khard.conf.html
command line usage 2
====================
.. argparse::
:module: khard.cli
:func: _sphinxarg_helper
:prog: khard
3 changes: 3 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def update_template_file():
'sphinx.ext.autosectionlabel',
'sphinx.ext.todo',
'sphinx_autodoc_typehints', # https://pypi.org/project/sphinx-autodoc-typehints/
'sphinxarg.ext',
]

autoapi_type = 'python'
Expand Down Expand Up @@ -136,6 +137,8 @@ def update_template_file():
man_pages = [
('man/khard', 'khard', 'Console address book manager', '', 1),
('man/khard.conf', 'khard.conf', 'configuration file for khard', '', 5),
('man/khard_new', 'khard_foo', 'foo for khard', '', 1),
('man/khard_new2', 'khard_bar', 'foo for khard', '', 1),
]


Expand Down
1 change: 1 addition & 0 deletions doc/source/man.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ The following man pages are available for khard:

khard(1) <man/khard>
khard.conf(1) <man/khard.conf>
new <man/khard_new.rst>
8 changes: 8 additions & 0 deletions doc/source/man/khard_new.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
foo
===

.. argparse::
:module: khard.cli
:func: _sphinxarg_helper
:prog: khard
:manpage:
7 changes: 7 additions & 0 deletions doc/source/man/khard_new2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
foo
===

.. argparse::
:module: khard.cli
:func: _sphinxarg_helper
:prog: khard
5 changes: 5 additions & 0 deletions khard/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,8 @@ def init(argv: list[str]) -> tuple[argparse.Namespace, Config]:
return args, merge_args_into_config(args, conf)
except ConfigError as err:
sys.exit(str(err))


def _sphinxarg_helper():
"""Helper function to return the correct argument parser for the docs."""
return create_parsers()[1]
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ dependencies = [
]

[project.optional-dependencies]
doc = ['sphinx', 'sphinx-autoapi', 'sphinx-autodoc-typehints']
doc = [
'sphinx',
'sphinx-argparse',
'sphinx-autoapi',
'sphinx-autodoc-typehints',
]

[project.urls]
homepage = "https://github.com/lucc/khard"
Expand Down

0 comments on commit 01bb87a

Please sign in to comment.