i3keybinds.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:i3-used-keybinds 作者: AndrewOlsen 项目源码 文件源码
def output(keybind="", command=""):
    '''Output the keybinds in a nice table.
    Call fix_table if needed.
    '''
    headers = ['Keybind', 'Modifier', 'Command']
    t_data = []
    if binds:
        binds.sort()
        for l in binds:
            if keybind:
                if keybind in l[0].lower():
                    t_data.append(l)
            elif command:
                if command in l[2].lower():
                    t_data.append(l)
            else:
                t_data.append(l)
        if t_data:
            t_data.insert(0, headers)
            table = SingleTable(t_data)
            if table.ok:
                if args.verbose:
                    print('Table ok.')
                print(table.table)
            else:
                fix_table(table)
                print(table.table)
        else:
            print('No keybinds found.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号