protected function initialize(InputInterface $input, OutputInterface $output)
    {
        parent::initialize($input, $output);

        $this->input = $input;
        $this->output = $output;

        // prepend include_path if demanded
        $path = $input->getOption('include-path');
        if (!empty($path)) {
            ini_set('include_path', $path . PATH_SEPARATOR . ini_get('include_path'));
        }

        // run given bootstrap file if necessary
        $bootstrap_path = $input->getOption('bootstrap');
        if (!empty($bootstrap_path)) {
            if (!is_readable($bootstrap_path)) {
                throw new \InvalidArgumentException('Bootstrap file "' . $bootstrap_path . '" is not readable.');
            }

            if ($this->input->getOption('verbose')) {
                $output->writeln('<comment>Requiring boostrap file from "' . $bootstrap_path . '".</comment>');
            }
            require $bootstrap_path;
        }

        // we autoload classes from the current working directory or the specified autoload_dir
        $autoload_dir = $input->getOption('autoload-dir');
        if (!empty($autoload_dir)) {
            if (!is_readable($autoload_dir)) {
                throw new \InvalidArgumentException(
                    'Autoload path "' . $autoload_dir . '" is not readable. Please specify an existing directory.'
                );
            }

            if ($this->input->getOption('verbose')) {
                $output->writeln('<comment>Classes will be autoloaded from "' . $autoload_dir . '".</comment>');
            }
        } else {
            if ($this->input->getOption('verbose')) {
                $output->writeln(
                    '<comment>No autoload_dir specified, using "' . $this->getCurrentWorkingDirectory() .
                    '" to autoload classes from.</comment>'
                );
            }
        }

        spl_autoload_register(array($this, 'autoload'));
    }