[doc] Add description, usage and notes to all modules

This commit is contained in:
Tobias Witek 2016-10-31 16:08:03 +01:00
parent 598f3e70e9
commit c0421163d4
10 changed files with 92 additions and 3 deletions

View file

@ -2,13 +2,13 @@ import datetime
import bumblebee.module
def usage():
return "battery::<battery ID, defaults to BAT0>"
return "battery or battery::<battery ID, defaults to BAT0>"
def notes():
return "Reads /sys/class/power_supply/<ID>/[capacity|status]"
return "Reads /sys/class/power_supply/<ID>/[capacity|status]. Warning is at 20% remaining charge, Critical at 10%."
def description():
return "Displays battery status, percentage and whether it's charging or discharging"
return "Displays battery status, percentage and whether it's charging or discharging."
class Module(bumblebee.module.Module):
def __init__(self, args):

View file

@ -1,6 +1,15 @@
import bumblebee.module
import psutil
def usage():
return "cpu"
def notes():
return "Warning is at 70%, Critical at 80%."
def description():
return "Displays CPU utilization across all CPUs."
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)

View file

@ -2,6 +2,15 @@ import os
import bumblebee.util
import bumblebee.module
def usage():
return "disk or disk::<path, defaults to '/'>"
def notes():
return "Warning is at 20% free diskspace, Critical at 10%."
def description():
return "Shows free diskspace, total diskspace and the percentage of free disk space."
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)

View file

@ -6,6 +6,15 @@ import subprocess
import bumblebee.module
import bumblebee.util
def usage():
return "dnf or dnf::<interval in seconds, defaults to 3600>"
def notes():
return "Spawns a separate thread that invokes 'dnf updateinfo' every <interval> seconds. Critical status is if there is either more than 50 updates pending, or at least one of them is a security update."
def description():
return "Checks DNF for updated packages and displays the number of <security>/<bugfixes>/<enhancements>/<other> pending updates."
def get_dnf_info(obj):
while True:
try:

View file

@ -2,6 +2,15 @@ import psutil
import bumblebee.module
import bumblebee.util
def usage():
return "memory"
def notes():
return "Warning is at 20% available RAM, Critical at 10%."
def description():
return "Shows available RAM, total amount of RAM and the percentage of available RAM."
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)

View file

@ -2,6 +2,15 @@ import pyroute2
import netifaces
import bumblebee.module
def usage():
return "nic"
def notes():
return "Interfaces starting with 'lo' or 'virbr' are ignored. Critical if the status of an interface is 'down', Warning if it is anything else but 'up'. Interface status is derived from whether an IP address is available or not."
def description():
return "Displays the names, IP addresses and status of each available interface."
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)

View file

@ -5,6 +5,26 @@ import subprocess
import bumblebee.module
import bumblebee.util
def usage():
module = __name__.split(".")[-1]
if module == "pasource":
return "pasource"
if module == "pasink":
return "pasink"
return "pulseaudio"
def notes():
return "Invokes 'pactl' to retrieve information."
pass
def description():
module = __name__.split(".")[-1]
if module == "pasink":
return "Shows volume and mute status of the default PulseAudio Sink."
if module == "pasource":
return "Shows volume and mute status of the default PulseAudio Source."
return "See 'pasource'."
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)

View file

@ -1,6 +1,15 @@
import bumblebee.module
import bumblebee.util
def usage():
return "spacer"
def notes():
return "none"
def description():
return "Draws an empty field."
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)

View file

@ -3,6 +3,20 @@ from __future__ import absolute_import
import datetime
import bumblebee.module
def usage():
module = __name__.split(".")[-1]
if module == "date":
return "date::<strftime format string, defaults to %x>"
if module == "time":
return "time::<strftime format string, defaults to %X>"
return "datetime::<strftime format string, defaults to '%x %X'>"
def notes():
return "none"
def description():
return "Displays the current time, using the optional format string as input for strftime."
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)

View file

@ -25,6 +25,7 @@ def print_module_list():
print textwrap.fill("Description: {}".format(desc), 80, initial_indent=" ", subsequent_indent=" ")
print textwrap.fill("Usage : {}".format(usage), 80, initial_indent=" ", subsequent_indent=" ")
print textwrap.fill("Notes : {}".format(notes), 80, initial_indent=" ", subsequent_indent=" ")
print "\n"
def main():
parser = argparse.ArgumentParser(description="display system data in the i3bar")