Use this for detecting the org and repo.

Add the options to decorateDefinition.

@param ConsoleEvent $event
198656
public function initialize(ConsoleEvent $event)
    {
        $command = $event->getCommand();

        if (!$command instanceof InitCommand) {
            return;
        }

        if (!$this->gitHelper->isGitDir()) {
            throw new UserException(
                sprintf(
                    'You can only run the "%s" command when you are in a Git directory.',
                    $command->getName()
                )
            );
        }

        $input = $event->getInput();

        $input->setOption(
            'repo-adapter',
            GitHelper::undefinedToDefault($input->getOption('repo-adapter'), $this->detectAdapterName())
        );

        $input->setOption(
            'issue-adapter',
            GitHelper::undefinedToDefault(
                $input->getOption('issue-adapter'),
                $input->getOption('repo-adapter')
            )
        );

        if (!$this->application->getAdapterFactory()->supports($input->getOption('repo-adapter'), AdapterFactory::SUPPORT_REPOSITORY_MANAGER)) {
            return;
        }

        $org = GitHelper::undefinedToDefault($input->getOption('org'));
        $repo = GitHelper::undefinedToDefault($input->getOption('repo'));

        if (null === $org || null === $repo) {
            list($org, $repo) = $this->getRepositoryReference(
                $this->getAdapter($input->getOption('repo-adapter')),
                $org,
                $repo
            );

            if (!$input->isInteractive()) {
                $this->styleHelper->note(
                    [
                        'You did not provide an organization and/or repository name.',
                        'Gush automatically detected the missing information.',
                        sprintf('Org: "%s" / repo: "%s"', $org, $repo),
                    ]
                );
            }

            $input->setOption('org', $org);
            $input->setOption('repo', $repo);
        }

        $input->setOption('issue-org', GitHelper::undefinedToDefault($input->getOption('issue-org'), $org));
        $input->setOption('issue-project', GitHelper::undefinedToDefault($input->getOption('issue-project'), $repo));
    }
961820
public static function integrate(Event $event)
    {
        $filesystem = new Filesystem();

        $composerBinDir = $event->getComposer()->getConfig()->get('bin-dir');
        $executable = getcwd().'/bin/grumphp';
        $composerExecutable = $composerBinDir.'/grumphp';
        $filesystem->copy(
            self::noramlizePath($executable),
            self::noramlizePath($composerExecutable)
        );

        $commandlineArgs = ProcessArgumentsCollection::forExecutable($composerExecutable);
        $commandlineArgs->add('git:init');

        $process = ProcessFactory::fromArguments($commandlineArgs);
        $process->run();
        if (!$process->isSuccessful()) {
            $event->getIO()->write(
                '<fg=red>GrumPHP can not sniff your commits. Did you specify the correct git-dir?</fg=red>'
            );
            $event->getIO()->write('<fg=red>'.$process->getErrorOutput().'</fg=red>');

            return;
        }

        $event->getIO()->write('<fg=yellow>'.$process->getOutput().'</fg=yellow>');
    }
152836
public function onConsoleCommand(ConsoleCommandEvent $event)
    {
        if (!$this->processRepository->createSchemaIfNotExists()) {
            throw new Exception('Cannot create schema for ConsoleProcessManagerBundle');
        }

        $argv = $_SERVER['argv'];
        unset($argv[0]);
        $command = implode(' ', $argv);

        if (!$process = $this->processRepository->findOneByCommand($command)) {
            $commandName = $event->getCommand()->getName();
            $process = $this->processRepository->createProcess($commandName, $command);
        }

        $call = new Call();
        $call->setStatus(Call::STATUS_STARTED);
        $call->setConsolePid($this->getPid());

        $this->processRepository->addCallToProcess($process, $call);

        $process->setLastCall($call);
        $this->processRepository->update($process);

        $_REQUEST['call_id'] = $call->getId();
    }
372267
public function onTopBarLeftMenuConfigure(ConfigureMenuEvent $event)
    {
        $user = $this->tokenStorage->getToken()->getUser();

        //this is still configurable in the core bundle and should be changed...
        $isActive = $this->ch->getParameter('is_notification_active');

        if ('anon.' !== $user && $isActive) {
            $countUnviewedNotifications = $this->notificationManager->countUnviewedNotifications($user);

            $end = $this->templating->render(
                'IcapNotificationBundle:notification:dropdown_script.html.twig',
                ['notificationElementId' => 'notification-topbar-item']
            );

            $menu = $event->getMenu();
            $countUnviewedNotificationsMenuLink = $menu->addChild(
                $this->translator->trans('notifications', [], 'platform'),
                ['route' => 'icap_notification_view']
            )
                ->setExtra('icon', 'fa fa-bell')
                ->setExtra('title', $this->translator->trans('notifications', [], 'platform'))
                ->setAttribute('id', 'notification-topbar-item')
                ->setExtra('close', $end);

            if (0 < $countUnviewedNotifications) {
                $countUnviewedNotificationsMenuLink
                    ->setExtra('badge', $countUnviewedNotifications);
            }

            return $menu;
        }
    }
1139937
public static function postPackageInstall(Event $event)
    {
        $config = $event->getComposer()->getConfig();
        $binDir = $config->get("bin-dir");
        self::initScript($binDir);

    }
465340
public function command(ConsoleCommandEvent $event)
    {
        /** @var ManifestCommand $command */
        $command = $event->getCommand();

        if (!in_array($command->getName(), $this->getSupportedCommands())) {
            return;
        }

        $command->setChain($this->chain);

        if ($command instanceof RunCommand) {
            $command->setEventDispatcher($this->dispatcher);
        }
    }
675654
public function preOperation(Event $event)
    {
        $patchCollection = $this->getPatchCollection();
        if ($patchCollection->isEmpty()) {
            return;
        }
        $packages = $this->getLocalRepositoryPackages();
        foreach ($packages as $package) {
            if ($this->mustUninstallPackage($package)) {
                $this->uninstallPackage($package);
            }
        }
    }
769269
public function command(ConsoleCommandEvent $event)
    {
        /** @var BridgeCommand $command */
        $command = $event->getCommand();

        if (!in_array($command->getName(), $this->getSupportedCommands())) {
            return;
        }

        $command->setRegistry($this->registry);
    }
5839
public function onPostAutoloadDump(Event $event)
    {
        $this->io->writeError('<info>Generating extensions files</info>');
        foreach ($this->getPackages() as $package) {
            if ($package instanceof \Composer\Package\CompletePackageInterface) {
                $this->processPackage($package);
            }
        }
        $this->processPackage($this->composer->getPackage());

        foreach ($this->data as $name => $data) {
            $this->saveFile($this->buildOutputPath($name), $data);
        }
    }
181925
public function postOperation(Event $event)
    {
        $this->refreshPatchCollection();
        $patchCollection = $this->getPatchCollection();
        if ($patchCollection->isEmpty()) {
            $this->io->write('<info>No patches supplied.</info>');

            return;
        }
        $packages = $this->getLocalRepositoryPackages();
        foreach ($packages as $package) {
            if ($this->mustInstallPatchesForPackage($package)) {
                $this->installPatchesForPackage($package);
            }
        }
    }
303804
public static function postInstall(Event $event)
    {
        // initialize the installation directory
        $override = false;
        $installDir = getcwd();

        // check the arguments for an installation directory
        foreach ($event->getArguments() as $arg) {
            // extract arguments
            list ($key, ) = explode('=', $arg);
            // query we want to override files
            if ($key === SetupKeys::ARG_OVERRIDE) {
                $override = true;
            }
            // query for a custom installation directory
            if ($key === SetupKeys::ARG_INSTALL_DIR) {
                $installDir = str_replace("$key=", '', $arg);
            }
        }

        Setup::prepareContext($installDir, $event);

        // process and move the configuration files their target directory
        Setup::processTemplate('etc/appserver/appserver.xml', $override);
        Setup::processTemplate('etc/appserver/appserver-runner.xml', $override);

        // write a message to the console
        $event->getIo()->write(
            sprintf(
                '%s<info>Successfully invoked appserver.io Composer post-install-cmd script ...</info>',
                Setup::$logo
            )
        );
    }
908658
public function onPostCmdEvent(Event $event) {
    // Only install the template files if acquia/blt was installed.
    if (isset($this->bltPackage)) {
      $version = $this->bltPackage->getVersion();
      $this->executeBltUpdate($version);
    }
  }
292851
public static function packageInKernel(PackageEvent $event)
    {
        self::addJobByOperationType(
            $event->getOperation(),
            function ($package) {
                return new AddKernel($package);
            },
            function ($package) {
                return new RemoveKernel($package);
            }
        );
    }
311810
public static function warmProductionCache(Event $event)
    {
        $consoleDir = static::getConsoleDir($event, 'warm the cache');
        if ($consoleDir === null) {
            return;
        }

        static::executeCommand($event, $consoleDir, 'cache:warm -e prod');
    }
22179
public function onPostPackageEvent(PackageEvent $event) {
    // Get the effected package from the Event.
    $installed_package = NULL;
    $operation = $event->getOperation();
    if ($operation instanceof UpdateOperation) {
      $installed_package = $operation->getTargetPackage();
    }
    else {
      $installed_package = $operation->getPackage();
    }
    $package_extra = $installed_package->getExtra();

    // If the effected package has installers, reset cached installers.
    if (isset($package_extra) && isset($package_extra['installer-paths'])) {
      $composer = $event->getComposer();
      $composer->getInstallationManager()->removeInstaller($this->installer);
      $composer->getInstallationManager()->addInstaller($this->installer);
      $this->installer->clearCache();
    }
  }
1225281
public static function installThemesAndFiles(Event $event)
    {
        $syncer = DirectorySyncer::fromEvent($event);

        $syncer->sync('files', 'files');
        $syncer->sync('%vendor%/bolt/themes', 'themes', true, ['base-2016', 'base-2018', 'skeleton']);
    }
807469
public function onPreDependenciesSolving(InstallerEvent $event)
    {
        if ($this->config->get('enabled', true)) {
            $this->assetRepositoryManager->setPool($event->getPool());
        }
    }