libqtile/scripts/qtile_cmd.py
def print_commands(prefix, obj):
    "Print available commands for given object."
    prefix += " -f "
    output = []
    max_cmd = 0  # max len of cmd for formatting

    try:
        cmds = obj.commands()
    except AttributeError:
        print("error: Sorry no commands in ", prefix)
        exit()
    except CommandError:
        print("error: Sorry no such object ", prefix)
        exit()

    for cmd in cmds:
        doc_args = get_formated_info(obj, cmd)

        pcmd = prefix + cmd
        max_cmd = max(len(pcmd), max_cmd)
        output.append([pcmd, doc_args])

    # Print formatted output
    formating = "{:<%d}\t{}" % (max_cmd + 1)
    for line in output:
        print(formating.format(line[0], line[1]))
Print available commands for given object.
Print available commands for given object.
Print available commands for given object .
def print_commands(prefix, obj):
    prefix += " -f "
    output = []
    max_cmd = 0  
    try:
        cmds = obj.commands()
    except AttributeError:
        print("error: Sorry no commands in ", prefix)
        exit()
    except CommandError:
        print("error: Sorry no such object ", prefix)
        exit()
    for cmd in cmds:
        doc_args = get_formated_info(obj, cmd)
        pcmd = prefix + cmd
        max_cmd = max(len(pcmd), max_cmd)
        output.append([pcmd, doc_args])
    formating = "{:<%d}\t{}" % (max_cmd + 1)
    for line in output:
        print(formating.format(line[0], line[1]))
def print_commands ( prefix , obj ) : prefix += " -f " output = [ ] max_cmd = 0 try : cmds = obj . commands ( ) except AttributeError : print ( "error: Sorry no commands in " , prefix ) exit ( ) except CommandError : print ( "error: Sorry no such object " , prefix ) exit ( ) for cmd in cmds : doc_args = get_formated_info ( obj , cmd ) pcmd = prefix + cmd max_cmd = max ( len ( pcmd ) , max_cmd ) output . append ( [ pcmd , doc_args ] ) formating = "{:<%d}\t{}" % ( max_cmd + 1 ) for line in output : print ( formating . format ( line [ 0 ] , line [ 1 ] ) )
Print available commands for given object.
Print available commands for given object .
"Print available commands for given object." # max len of cmd for formatting # Print formatted output
prefix
obj