[doc] Update list of modules to produce RST output

Also, adapt some module docstrings to conform with RST
This commit is contained in:
tobi-wan-kenobi 2020-05-05 20:33:27 +02:00
parent 456a3ec4a4
commit 5da0819610
14 changed files with 1186 additions and 941 deletions

View file

@ -50,9 +50,9 @@ class print_usage(argparse.Action):
self._args = namespace
self._format = "plain"
self.print_modules()
elif value == "modules-markdown":
elif value == "modules-rst":
self._args = namespace
self._format = "markdown"
self._format = "rst"
self.print_modules()
elif value == "themes":
self.print_themes()
@ -62,14 +62,12 @@ class print_usage(argparse.Action):
print(", ".join(core.theme.themes()))
def print_modules(self):
if self._format == "markdown":
print("# Table of modules")
print("|Name |Description |")
print("|-----|------------|")
basepath = os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
)
if self._format == "rst":
print("List of modules\n===============")
for m in all_modules():
try:
filename = os.path.join(basepath, "modules", "core", "{}.py".format(m))
@ -89,19 +87,13 @@ class print_usage(argparse.Action):
if not doc:
log.warning("failed to find docstring for {}".format(m))
continue
if self._format == "markdown":
doc = doc.replace("<", "\<")
doc = doc.replace(">", "\>")
doc = doc.replace("\n", "<br />")
if self._format == "rst":
print("\n{}\n{}\n".format(m, "-" * len(m)))
if os.path.exists(
os.path.join(basepath, "screenshots", "{}.png".format(m))
):
doc = "{}<p /><p />![{}](../screenshots/{}.png)".format(
doc, m, m
)
print("|{} |{} |".format(m, doc))
doc = "{}\n\n.. image:: ../screenshots/{}.png".format(doc, m)
print(doc)
else:
print(
textwrap.fill(
@ -173,7 +165,7 @@ class Config(util.store.Store):
parser.add_argument(
"-l",
"--list",
choices=["modules", "themes", "modules-markdown"],
choices=["modules", "themes", "modules-rst"],
help="Display a list of available themes or available modules, along with their parameters",
action=print_usage,
)

View file

@ -23,7 +23,8 @@ author = "tobi-wan-kenobi"
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ---------------------------------------------------

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
"""Displays APT package update information (<to upgrade>/<to remove >)
Requires the following packages:
* aptitude
"""

View file

@ -15,6 +15,7 @@ Requirements:
Parameters:
* cpu2.layout: Space-separated list of widgets to add.
Possible widgets are:
* cpu2.maxfreq
* cpu2.cpuload

View file

@ -28,6 +28,7 @@ Parameters:
* deadbeef.previous: Change binding for previous song (default is left click)
* deadbeef.next: Change binding for next song (default is right click)
* deadbeef.pause: Change binding for toggling pause (default is middle click)
Available options for deadbeef.previous, deadbeef.next and deadbeef.pause are:
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN

View file

@ -1,14 +1,17 @@
# pylint: disable=C0111,R0903
"""Displays the current song being played
Requires the following library:
* python-dbus
Parameters:
* deezer.format: Format string (defaults to '{artist} - {title}')
Available values are: {album}, {title}, {artist}, {trackNumber}, {playbackStatus}
* deezer.previous: Change binding for previous song (default is left click)
* deezer.next: Change binding for next song (default is right click)
* deezer.pause: Change binding for toggling pause (default is middle click)
Available options for deezer.previous, deezer.next and deezer.pause are:
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN
"""

View file

@ -1,4 +1,5 @@
"""Displays count of running libvirt VMs.
Required the following python packages:
* libvirt
"""

View file

@ -8,6 +8,7 @@ Requires the following executable:
Parameters:
* mpd.format: Format string for the song information.
Supported tags (see `man mpc` for additional information)
* {name}
* {artist}
@ -28,6 +29,7 @@ Parameters:
* {prio}
* {mtime}
* {mdate}
Additional tags:
* {position} - position of currently playing song
not to be confused with %position% mpc tag
@ -36,6 +38,7 @@ Parameters:
if {file} = '/foo/bar.baz', then {file1} = 'bar.baz'
* {file2} - song file name without path prefix and extension suffix
if {file} = '/foo/bar.baz', then {file2} = 'bar'
* mpd.host: MPD host to connect to. (mpc behaviour by default)
* mpd.layout: Space-separated list of widgets to add. Possible widgets are the buttons/toggles mpd.prev, mpd.next, mpd.shuffle and mpd.repeat, and the main display with play/pause function mpd.main.
"""

View file

@ -1,6 +1,7 @@
# pylint: disable=C0111,R0903
"""Displays the pi-hole status (up/down) together with the number of ads that were blocked today
Parameters:
* pihole.address : pi-hole address (e.q: http://192.168.1.3)
* pihole.pwhash : pi-hole webinterface password hash (can be obtained from the /etc/pihole/SetupVars.conf file)

View file

@ -1,14 +1,17 @@
# pylint: disable=C0111,R0903
"""Displays the current song being played
Requires the following library:
* python-dbus
Parameters:
* spotify.format: Format string (defaults to '{artist} - {title}')
Available values are: {album}, {title}, {artist}, {trackNumber}, {playbackStatus}
* spotify.previous: Change binding for previous song (default is left click)
* spotify.next: Change binding for next song (default is right click)
* spotify.pause: Change binding for toggling pause (default is middle click)
Available options for spotify.previous, spotify.next and spotify.pause are:
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN
"""

View file

@ -6,6 +6,7 @@
adds the possibility to
* shutdown
* reboot
the system.
Per default a confirmation dialog is shown before the actual action is performed.

View file

@ -7,6 +7,7 @@ Requires the following executable:
Parameters:
* cmus.format: Format string for the song information. Tag values can be put in curly brackets (i.e. {artist})
Additional tags:
* {file} - full song file name
* {file1} - song file name without path prefix