doodledashboard/cli.py
def list(component_type):
    """List components that are available on your machine"""
    config_loader = initialise_component_loader()
    component_types = sorted({
         "displays": lambda: config_loader.load_by_type(ComponentType.DISPLAY),
         "datafeeds": lambda: config_loader.load_by_type(ComponentType.DATA_FEED),
         "filters": lambda: config_loader.load_by_type(ComponentType.FILTER),
         "notifications": lambda: config_loader.load_by_type(ComponentType.NOTIFICATION)
    }.items(), key=lambda t: t[0])

    def print_ids(creators):
        ids = {c.id_key_value[1] if hasattr(c, "id_key_value") else c.get_id() for c in creators}
        for i in sorted(ids):
            click.echo(" - %s" % i)

    for k, v in component_types:
        if component_type == k or component_type == "all":
            click.echo("Available %s:" % k)
            print_ids(v())

        if component_type == "all":
            click.echo("")
def list(component_type):
    """List components that are available on your machine"""
    config_loader = initialise_component_loader()
    component_types = sorted({
         "displays": lambda: config_loader.load_by_type(ComponentType.DISPLAY),
         "datafeeds": lambda: config_loader.load_by_type(ComponentType.DATA_FEED),
         "filters": lambda: config_loader.load_by_type(ComponentType.FILTER),
         "notifications": lambda: config_loader.load_by_type(ComponentType.NOTIFICATION)
    }.items(), key=lambda t: t[0])

    def print_ids(creators):
        ids = {c.id_key_value[1] if hasattr(c, "id_key_value") else c.get_id() for c in creators}
        for i in sorted(ids):
            click.echo(" - %s" % i)

    for k, v in component_types:
        if component_type == k or component_type == "all":
            click.echo("Available %s:" % k)
            print_ids(v())

        if component_type == "all":
            click.echo("")
def list ( component_type ) : config_loader = initialise_component_loader ( ) component_types = sorted ( { "displays" : lambda : config_loader . load_by_type ( ComponentType . DISPLAY ) , "datafeeds" : lambda : config_loader . load_by_type ( ComponentType . DATA_FEED ) , "filters" : lambda : config_loader . load_by_type ( ComponentType . FILTER ) , "notifications" : lambda : config_loader . load_by_type ( ComponentType . NOTIFICATION ) } . items ( ) , key = lambda t : t [ 0 ] ) def print_ids ( creators ) : ids = { c . id_key_value [ 1 ] if hasattr ( c , "id_key_value" ) else c . get_id ( ) for c in creators } for i in sorted ( ids ) : click . echo ( " - %s" % i ) for k , v in component_types : if component_type == k or component_type == "all" : click . echo ( "Available %s:" % k ) print_ids ( v ( ) ) if component_type == "all" : click . echo ( "" )
List components that are available on your machine
List components that are available on your machine