protected function getConfiguration(InputInterface $input): ConsoleConfigInterface
    {
        // If the configuration to use is the default.
        if ($input->getOption('default')) {
            $this->validatePathsExist($input);
            // If it is a directory.
            if ($input->getOption('dir')) {
                return (new DefaultConsoleConfigFactory())
                    ->invokeDir($input->getArgument('source'), $input->getArgument('target'));
            }
            return (new DefaultConsoleConfigFactory())
                ->invokeFile($input->getArgument('source'), $input->getArgument('target'));
        }

        $path = $input->getOption('config');
        // If we have a "=" at the beginning of the option value
        $path = preg_replace('/^\=/', '', $path);

        $factory = $this->getConfigurationFactory($path);

        if ($input->getOption('dir')) {
            $this->validatePathsExist($input);
            return $factory->invokeDir(
                $path,
                $input->getArgument('source'),
                $input->getArgument('target')
            );
        }
        if ($input->getOption('file')) {
            $this->validatePathsExist($input);
            return $factory->invokeFile(
                $path,
                $input->getArgument('source'),
                $input->getArgument('target')
            );
        }
        return $factory->invoke($path);
    }