def cmd_obj(args) -> None:
    "Runs tool according to specified arguments."

    if args.obj_spec:
        sock_file = args.socket or find_sockfile()
        ipc_client = Client(sock_file)
        cmd_object = IPCCommandInterface(ipc_client)
        cmd_client = CommandClient(cmd_object)
        obj = get_object(cmd_client, args.obj_spec)

        if args.function == "help":
            try:
                print_commands("-o " + " ".join(args.obj_spec), obj)
            except CommandError:
                if len(args.obj_spec) == 1:
                    print(
                        f"{args.obj_spec} object needs a specified identifier e.g. '-o bar top'."
                    )
                    sys.exit(1)
                else:
                    raise
        elif args.info:
            print(args.function + get_formated_info(obj, args.function, args=True, short=False))
        else:
            ret = run_function(obj, args.function, args.args, args.kwargs)
            if ret is not None:
                print(json.dumps(ret, indent=2, default=set_to_list))
    else:
        print_base_objects()
        sys.exit(1)
Runs tool according to specified arguments.
libqtile/scripts/cmd_obj.py