public function dispatch($argv){
        $name = reset($argv);

        if(!$this->hasCommand($name)){
            throw new \InvalidArgumentException('Command not found');
        }

        // load command
        $command = $this->commands[$name];

        // parse arguments
        $arguments = $command->getArguments();
        $arguments->parse($argv);

        // execute command
        $handler = $command->getHandler();
        if(is_array($handler)){
            $class = $handler[0];
//            if($this->container->has($class)){
//                $this->container->add($class);
//            }
            $obj = $this->container->get($class);
            $handler[0] = $obj;
        }
        call_user_func_array($handler, [$arguments]);
    }