Register a command for early invocation, generally before WordPress loads.

@param string $when Named execution hook
@param WP_CLI\Dispatcher\Subcommand $command
195781
public function register_early_invoke( $when, $command ) {
		$this->early_invoke[ $when ][] = array_slice( Dispatcher\get_path( $command ), 1 );
	}
642898
public function addCommand(Command $command) {
        $this->commands[$command->getName()] = $command;
        $command->freeze();
        return $this;
    }
765551
protected void fireCommandRegistered(AbstractCommand command) {
        
        Assert.notNull(command, "command");
        
        if (commandRegistryListeners.isEmpty()) {
            return;
        }
        
        CommandRegistryEvent event = new CommandRegistryEvent(this, command);
        
        for (Iterator i = commandRegistryListeners.iterator(); i.hasNext();) {
            ((CommandRegistryListener)i.next()).commandRegistered(event);
        }
        
    }
14772
protected function registerAppContainerCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Commands\AppContainerCommand($app);
        });
    }
1123765
protected function registerMakePolicyCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\PolicyMakeCommand($app);
        });
    }
880742
private function beforeAfterControllerAction(string $when): void
    {
        $method = $when.\ucfirst($this->routeAction);

        if (\method_exists($this->controller, $method) && $method !== $when) {
            \call_user_func([$this->controller, $method]);
        }
    }
1040633
protected function registerMakeEventCommand($command)
     {
         $this->app->singleton($command, function ($app) {
             return new Generators\Commands\EventMakeCommand($app);
         });
     }
470246
protected function fireBeforeCommandEvent($command)
	{
		$eventName = $this->commandNameToEventName($command);

		$args = [$command];

		$this->fireEvent($eventName, 'before', $args);
	}
690620
def register(self, command):
        
        command = command()
        if command.name in self.commands:
            raise ConsoleError(
                "Command %s already registered!" % command.name
            )

        command.create_parser(self.subparsers)
        self.commands[command.name] = command
1318533
public function handle(ClaimInviteCommand $command)
    {
        $invite = $command->invite;

        $invite->update(['claimed_at' => Carbon::now()]);

        event(new InviteWasClaimedEvent($invite));
    }
350215
protected function setCommand($command)
    {
        $this->command = $command;

        if (!is_null($this->loader)) {
            $this->loader->setCommand($this->command);
        }
    }
1130097
public function addCommand($command)
    {
        if (is_string($command)) {
            $command = $this->app->make($command);
        }

        if ($command instanceof Command) {
            $command->setLaravel($this->app);
        }

        $this->console->add($command);
    }
125996
protected function registerMakeListenerCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\ListenerMakeCommand($app);
        });
    }
338493
function callbackCommandRegister(\CharlotteDunois\Livia\Commands\Command $command) {
        foreach($this->settings as $guild => $settings) {
            if($guild !== 'global' && !$this->client->guilds->has($guild)) {
                continue;
            }
            
            $this->setupGuildCommand($guild, $command, $settings);
        }
    }
702697
protected function registerCommands(array $commands)
	{
		if (!$this->app->runningInConsole()) {
			return;
		}

		foreach ($commands as $key => $command) {
			if (is_numeric($key)) {
				$key = Str::lower(str_replace("\\", '.', $command));
			}

			$method = "register{$command}";

			try {
				if (method_exists($this, $method)) {
					call_user_func_array([$this, $method], [$key]);
				} else {
					$this->app->singleton($key, function ($app) use ($command) {
						return $app->make($command);
					});
				}
				$this->commands($key);
			} catch (\Exception $e) {
				throw $e;
			}
		}
	}
1155892
protected function registerDatabaseStatusCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Database\Commands\DatabaseStatusCommand($app);
        });
    }
140824
protected function registerCommands(array $commands)
    {
        foreach (array_keys($commands) as $command) {
            call_user_func([$this, "register{$command}Command"]);
        }

        $this->commands(array_values($commands));
    }