Commit c4230bbc authored by David Huss's avatar David Huss 💬
Browse files

Add command abbreviations (e.g. bbbmon m)

parent 29880dc9
......@@ -77,3 +77,13 @@ For help run:
bbbmon -h
bbbmon supports command abbreviations – these commands produce the same result:
bbbmon meetings
bbbmon meeting
bbbmon mee
bbbmon m
This works as long as there is no other command starting with the same letters.
\ No newline at end of file
......@@ -16,16 +16,36 @@ from bbbmon.configuration import Config, Endpoint, SERVER_PROPERTIES_FILE, Url,
"participantCount": "Participants",
"listenerCount": "only listening",
"voiceParticipantCount": "Mics on",
"videoCount": "Webcams on",
"moderatorCount": "Number of Moderators"
"participantCount" : "Participants",
"listenerCount" : "only listening",
"voiceParticipantCount" : "Mics on",
"videoCount" : "Webcams on",
"moderatorCount" : "Number of Moderators"
# Allow -h as help option as well
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
class AliasedGroup(click.Group):
Subclass of Group to allow abbreviating commands like this:
Instead of `bbbmon meetings` one could type `bbbmon m`
def get_command(self, ctx, cmd_name):
rv = click.Group.get_command(self, ctx, cmd_name)
if rv is not None:
return rv
matches = [x for x in self.list_commands(ctx)
if x.startswith(cmd_name)]
if not matches:
return None
elif len(matches) == 1:
return click.Group.get_command(self, ctx, matches[0])'Too many matches: %s' % ', '.join(sorted(matches)))
def generate_checksum(call_name: str, query_string: str, secret: Secret) -> str:
Generate Checksum for the request header (passed as value for `?checksum=`)
......@@ -167,6 +187,7 @@ def print_leaderboard(meetings: Iterable[XmlDictConfig], key: str, endpoint_name
print("{:>5} {}".format(m[key], m["meetingName"]))
def print_duration_leaderboard(meetings: Iterable[XmlDictConfig], endpoint_name: str, presenter: bool, presenter_id: bool, fancy: bool):
Print a leaderboard of all meetings sorted by a given key (e.g.
......@@ -184,12 +205,14 @@ def print_duration_leaderboard(meetings: Iterable[XmlDictConfig], endpoint_name:
print("{:>12} {}".format(format_duration(m), m["meetingName"]))
def print_header(endpoint_name: str, text: str, fancy=True):
if fancy:
click.echo(" [{}] {} ".format(endpoint_name, text), fg='black', bg='white', bold=True))
print("[{}] {}".format(endpoint_name, text))
def print_overview(config: Config, leaderboards: bool, participants: bool, presenter: bool, presenter_id: bool, show_meetings: bool, watch: int, fancy: bool):
For each endpoint in the configuration get the active meetings and print
......@@ -254,7 +277,8 @@ def print_overview(config: Config, leaderboards: bool, participants: bool, prese
print_duration_leaderboard(meeting,, presenter, presenter_id, fancy), cls=AliasedGroup)
def main():
"""BBBMON is a small CLI utility to monitor bbb usage
......@@ -296,10 +320,7 @@ def meetings(ctx, leaderboards, participants, presenter, watch, presenter_id, me
@click.option('--print', 'print_', is_flag=True, help="Print the config to stdout")
@click.option('--path', is_flag=True, help="Print the path to the config")
def config(ctx, new, edit, path, print_):
"""Print, show or edit the config
Example: bbbmon config --new
"""Print, show or edit the config"""
user_config_path = get_user_config_path()
if edit:
name = "bbbmon"
version = "0.1.12"
version = "0.1.13"
description = "A small CLI utility to monitor bbb usage"
authors = ["David Huss <>"]
maintainers = ["David Huss <>"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment