def run(self):
        if self.args['<command>'].lower() == "help":
            self.display_help()
        else:
            cmdname = self.args['<command>']
            if cmdname not in self.commands:
                print("Unknown command: %r" % cmdname)
                self.display_help()
                sys.exit(1)

            # parse command arguments
            cmd = self.commands[cmdname]
            cmd_argv = [cmdname] + self.args['<args>']
            cmd_args =  docopt(cmd.__doc__, argv=cmd_argv)

            try:
                config = Config(self.args)
            except __HOLE__ as e:
                sys.stderr.write("config error: %s" % str(e))
                sys.exit(1)

            # finally launch the command
            cmd = self.commands[cmdname]
            try:
                return cmd.run(config, cmd_args)
            except GafferUnauthorized:
                print("Unauthorized access. You need an API key")
                sys.exit(1)
            except GafferForbidden:
                print("Forbidden access. API key permissions aren't enough")
                sys.exit(1)
            except tornado.httpclient.HTTPError as e:
                print("HTTP Error: %s\n" % str(e))
                sys.exit(1)

            except RuntimeError as e:
                sys.stderr.write("%s\n" % str(e))
                sys.exit(1)
            except Exception as e:
                import traceback
                print(traceback.format_exc())
                sys.stderr.write("%s\n" % str(e))
                sys.exit(1)
        sys.exit(0)
dataset/ETHPy150Open benoitc/gaffer/gaffer/cli/main.py/GafferCli.run