mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-13 19:54:21 +02:00
i3-companion: enhance help with list of functions
This commit is contained in:
parent
e089c59de5
commit
7a816e4292
1 changed files with 5 additions and 12 deletions
|
@ -1,10 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
"""Personal i3 companion
|
"""Personal i3 companion."""
|
||||||
|
|
||||||
This script will listen to i3 events and react accordingly.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
@ -24,11 +20,6 @@ from i3ipc import Event
|
||||||
logger = logging.getLogger(os.path.splitext(os.path.basename(sys.argv[0]))[0])
|
logger = logging.getLogger(os.path.splitext(os.path.basename(sys.argv[0]))[0])
|
||||||
|
|
||||||
|
|
||||||
class CustomFormatter(argparse.RawDescriptionHelpFormatter,
|
|
||||||
argparse.ArgumentDefaultsHelpFormatter):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def on(*events):
|
def on(*events):
|
||||||
"""Tag events that should be provided to the function."""
|
"""Tag events that should be provided to the function."""
|
||||||
def decorator(fn):
|
def decorator(fn):
|
||||||
|
@ -256,8 +247,10 @@ async def main(options):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Parse
|
# Parse
|
||||||
parser = argparse.ArgumentParser(
|
description = sys.modules[__name__].__doc__
|
||||||
description=sys.modules[__name__].__doc__)
|
for fn, events in on.functions.items():
|
||||||
|
description += f" {fn.__doc__}"
|
||||||
|
parser = argparse.ArgumentParser(description=description)
|
||||||
parser.add_argument("--debug", "-d", action="store_true",
|
parser.add_argument("--debug", "-d", action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
help="enable debugging")
|
help="enable debugging")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue