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

View file

@ -23,7 +23,8 @@ author = "tobi-wan-kenobi"
import os import os
import sys import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration --------------------------------------------------- # -- 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 >) """Displays APT package update information (<to upgrade>/<to remove >)
Requires the following packages: Requires the following packages:
* aptitude * aptitude
""" """

View file

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

View file

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

View file

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

View file

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

View file

@ -8,6 +8,7 @@ Requires the following executable:
Parameters: Parameters:
* mpd.format: Format string for the song information. * mpd.format: Format string for the song information.
Supported tags (see `man mpc` for additional information) Supported tags (see `man mpc` for additional information)
* {name} * {name}
* {artist} * {artist}
@ -28,6 +29,7 @@ Parameters:
* {prio} * {prio}
* {mtime} * {mtime}
* {mdate} * {mdate}
Additional tags: Additional tags:
* {position} - position of currently playing song * {position} - position of currently playing song
not to be confused with %position% mpc tag not to be confused with %position% mpc tag
@ -36,6 +38,7 @@ Parameters:
if {file} = '/foo/bar.baz', then {file1} = 'bar.baz' if {file} = '/foo/bar.baz', then {file1} = 'bar.baz'
* {file2} - song file name without path prefix and extension suffix * {file2} - song file name without path prefix and extension suffix
if {file} = '/foo/bar.baz', then {file2} = 'bar' if {file} = '/foo/bar.baz', then {file2} = 'bar'
* mpd.host: MPD host to connect to. (mpc behaviour by default) * 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. * 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 # pylint: disable=C0111,R0903
"""Displays the pi-hole status (up/down) together with the number of ads that were blocked today """Displays the pi-hole status (up/down) together with the number of ads that were blocked today
Parameters: Parameters:
* pihole.address : pi-hole address (e.q: http://192.168.1.3) * 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) * 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 # pylint: disable=C0111,R0903
"""Displays the current song being played """Displays the current song being played
Requires the following library: Requires the following library:
* python-dbus * python-dbus
Parameters: Parameters:
* spotify.format: Format string (defaults to '{artist} - {title}') * spotify.format: Format string (defaults to '{artist} - {title}')
Available values are: {album}, {title}, {artist}, {trackNumber}, {playbackStatus} Available values are: {album}, {title}, {artist}, {trackNumber}, {playbackStatus}
* spotify.previous: Change binding for previous song (default is left click) * spotify.previous: Change binding for previous song (default is left click)
* spotify.next: Change binding for next song (default is right click) * spotify.next: Change binding for next song (default is right click)
* spotify.pause: Change binding for toggling pause (default is middle click) * spotify.pause: Change binding for toggling pause (default is middle click)
Available options for spotify.previous, spotify.next and spotify.pause are: Available options for spotify.previous, spotify.next and spotify.pause are:
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN
""" """

View file

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

View file

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