libqtile/scripts/qtile_cmd.py
def main():
    "Runs tool according to specified arguments."
    description = 'Simple tool to expose qtile.command functionality to shell.'
    epilog = '''\
Examples:\n\
 qtile-cmd\n\
 qtile-cmd -o cmd\n\
 qtile-cmd -o cmd -f prev_layout -i\n\
 qtile-cmd -o cmd -f prev_layout -a 3 # prev_layout on group 3\n\
 qtile-cmd -o group 3 -f focus_back\n
'''
    fmt = argparse.RawDescriptionHelpFormatter

    parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                     formatter_class=fmt)
    parser.add_argument('--object', '-o', dest='obj_spec', nargs='+',
                        help='''Specify path to object (space separated).\
                        If no --function flag display available commands.''')
    parser.add_argument('--function', '-f', dest='function', nargs=1,
                        default="help", help='Select function to execute.')
    parser.add_argument('--args', '-a', dest='args', nargs='+',
                        default=[], help='Set arguments supplied to function.')
    parser.add_argument('--info', '-i', dest='info', action='store_true',
                        help='''With both --object and --function args prints\
                        documentation for function.''')
    args = parser.parse_args()

    if args.obj_spec:

        obj = get_object(args.obj_spec)

        if args.function == "help":
            print_commands("-o " + " ".join(args.obj_spec), obj)
        elif args.info:
            print(get_formated_info(obj, args.function[0],
                                    args=True, short=False))
        else:
            ret = run_function(obj, args.function[0], args.args)
            if ret is not None:
                pprint.pprint(ret)
            else:
                print_commands("-o " + " ".join(args.obj_spec), obj)

    else:
        print_base_objects()
Runs tool according to specified arguments.
Runs tool according to specified arguments.
Runs tool according to specified arguments .
def main():
    description = 'Simple tool to expose qtile.command functionality to shell.'
    epilog = '''\
Examples:\n\
 qtile-cmd\n\
 qtile-cmd -o cmd\n\
 qtile-cmd -o cmd -f prev_layout -i\n\
 qtile-cmd -o cmd -f prev_layout -a 3 # prev_layout on group 3\n\
 qtile-cmd -o group 3 -f focus_back\n
'''
    fmt = argparse.RawDescriptionHelpFormatter
    parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                     formatter_class=fmt)
    parser.add_argument('--object', '-o', dest='obj_spec', nargs='+',
                        help='''Specify path to object (space separated).\
                        If no --function flag display available commands.''')
    parser.add_argument('--function', '-f', dest='function', nargs=1,
                        default="help", help='Select function to execute.')
    parser.add_argument('--args', '-a', dest='args', nargs='+',
                        default=[], help='Set arguments supplied to function.')
    parser.add_argument('--info', '-i', dest='info', action='store_true',
                        help='''With both --object and --function args prints\
                        documentation for function.''')
    args = parser.parse_args()
    if args.obj_spec:
        obj = get_object(args.obj_spec)
        if args.function == "help":
            print_commands("-o " + " ".join(args.obj_spec), obj)
        elif args.info:
            print(get_formated_info(obj, args.function[0],
                                    args=True, short=False))
        else:
            ret = run_function(obj, args.function[0], args.args)
            if ret is not None:
                pprint.pprint(ret)
            else:
                print_commands("-o " + " ".join(args.obj_spec), obj)
    else:
        print_base_objects()
def main ( ) : description = 'Simple tool to expose qtile.command functionality to shell.' epilog = '''\
Examples:\n\
 qtile-cmd\n\
 qtile-cmd -o cmd\n\
 qtile-cmd -o cmd -f prev_layout -i\n\
 qtile-cmd -o cmd -f prev_layout -a 3 # prev_layout on group 3\n\
 qtile-cmd -o group 3 -f focus_back\n
''' fmt = argparse . RawDescriptionHelpFormatter parser = argparse . ArgumentParser ( description = description , epilog = epilog , formatter_class = fmt ) parser . add_argument ( '--object' , '-o' , dest = 'obj_spec' , nargs = '+' , help = '''Specify path to object (space separated).\
                        If no --function flag display available commands.''' ) parser . add_argument ( '--function' , '-f' , dest = 'function' , nargs = 1 , default = "help" , help = 'Select function to execute.' ) parser . add_argument ( '--args' , '-a' , dest = 'args' , nargs = '+' , default = [ ] , help = 'Set arguments supplied to function.' ) parser . add_argument ( '--info' , '-i' , dest = 'info' , action = 'store_true' , help = '''With both --object and --function args prints\
                        documentation for function.''' ) args = parser . parse_args ( ) if args . obj_spec : obj = get_object ( args . obj_spec ) if args . function == "help" : print_commands ( "-o " + " " . join ( args . obj_spec ) , obj ) elif args . info : print ( get_formated_info ( obj , args . function [ 0 ] , args = True , short = False ) ) else : ret = run_function ( obj , args . function [ 0 ] , args . args ) if ret is not None : pprint . pprint ( ret ) else : print_commands ( "-o " + " " . join ( args . obj_spec ) , obj ) else : print_base_objects ( )
Runs tool according to specified arguments.
Runs tool according to specified arguments .
"Runs tool according to specified arguments."