public static function ctag(Event $event)
    {
        $io = $event->getIO();

        try {
            self::confirmDevMode($event);
            $ctagCommand = self::getCtagCommand();
            $command = $ctagCommand::getCommand();
        } catch (\Exception $e) {
            $io->write('PhpCtagger: ' . $e->getMessage());

            return;
        }

        $io->write('Preparing to build tags file . . .');

        self::$vendorDir = realpath($event->getComposer()->getConfig()->get('vendor-dir'));
        $tagsFile = self::getTagsDir() . '/tags';
        self::deleteTagsFile($tagsFile);

        $autoloadNamespaces = include self::$vendorDir . '/composer/autoload_namespaces.php';

        // Flatten $paths array
        $paths = array();
        array_walk_recursive($autoloadNamespaces, function ($p) use (&$paths) {
            $paths[] = $p;
        });

        // In at least one instance, I've seen paths in the autoload_namespaces
        // file that don't exist. This removes them from the $paths array.
        $paths = array_filter($paths, function($path) {
            return(file_exists($path));
        });

        $options = " -f $tagsFile \
            -h '.php' \
            -R \
            --exclude='.git' \
            --exclude='.svn' \
            --totals=yes \
            --tag-relative=yes \
            --fields=+afkst \
            --PHP-kinds=+cf \
            --append=yes";

        foreach ($paths as $path) {
            chdir($path);
            exec($command . $options . ' 2>&1', $output);
            $io->write($output, true);
            unset($output);
        }

        $io->write('Tagfile complete!');
    }