Create a WP-CLI command for running Artisan.
352542
protected function registerArtisanCommand()
  {
    if (!class_exists('WP_CLI')) {
      return false;
    }
      
    /**
     * Run Laravel Artisan for this plugin
     */
    \WP_CLI::add_command($this->getCLICommandName(), function() {
      $args = [];

      // rebuild args, because WP_CLI does stuff to it...
      if (!empty($_SERVER['argv'])) {
        $args = array_slice($_SERVER['argv'], 2);
        array_unshift($args, $_SERVER['argv'][0]);
      }

      $this->artisan->handle(
        new \Symfony\Component\Console\Input\ArgvInput($args),
        new \Symfony\Component\Console\Output\ConsoleOutput
      );
    });
  }
447404
private function cmdJs()
    {
        echo "\n - JS -\n";
        if ($js = $this->config->get('js')) {
            if (!$this->subCmd) {
                foreach ($js as $k => $v) {
                    echo "\n - $k:\n";
                    $this->minify($v->filename, $v->add, $this->yuicompressor, $this->config->baseDir);
                }
                return;
            }

            if (isset($js->{$this->subCmd})) {
                echo "\n - ".$this->subCmd."\n";
                $this->minify($js->{$this->subCmd}->filename,
                  $js->{$this->subCmd}->add,
                  $this->yuicompressor,
                  $this->config->baseDir);
            } else {
                echo "\n Err: Not found!\n";
                return;
            }
        }
    }
1197390
public static function run(): void
    {
        foreach (self::COMMANDS as $name => $callable) {
            WP_CLI::add_command($name, $callable);
        }

        foreach (self::CHECKERS as $checker) {
            WP_CLI::add_wp_hook(CheckerCollectionFactory::REGISTER_HOOK, [$checker, 'register']);
        }

        // Register .toml config files.
        WP_CLI::add_wp_hook(ConfigPaths::HOOK, [ConfigPaths::class, 'mergeDefaultPath'], -50000);
        WP_CLI::add_wp_hook(ConfigPaths::HOOK, [ConfigPaths::class, 'mergeAbsPath'], 40000);
        WP_CLI::add_wp_hook(ConfigPaths::HOOK, [ConfigPaths::class, 'mergePreflightDir'], 50000);
    }
675057
def cmd_wp(self, args):
        ''''''
        usage = "usage: wp <editor|list|load|update|save|set|clear|loop|remove|move|movemulti|changealt>"
        if len(args) < 1:
            print(usage)
            return

        if args[0] == "load":
            if len(args) != 2:
                print("usage: wp load <filename>")
                return
            self.load_waypoints(args[1])
        elif args[0] == "update":
            if len(args) < 2:
                print("usage: wp update <filename> <wpnum>")
                return
            if len(args) == 3:
                wpnum = int(args[2])
            else:
                wpnum = -1
            self.update_waypoints(args[1], wpnum)
        elif args[0] == "list":
            self.wp_op = "list"
            self.master.waypoint_request_list_send()
        elif args[0] == "save":
            if len(args) != 2:
                print("usage: wp save <filename>")
                return
            self.wp_save_filename = args[1]
            self.wp_op = "save"
            self.master.waypoint_request_list_send()
        elif args[0] == "savecsv":
            if len(args) != 2:
                print("usage: wp savecsv <filename.csv>")
                return
            self.savecsv(args[1])
        elif args[0] == "savelocal":
            if len(args) != 2:
                print("usage: wp savelocal <filename>")
                return
            self.wploader.save(args[1])
        elif args[0] == "show":
            if len(args) != 2:
                print("usage: wp show <filename>")
                return
            self.wploader.load(args[1])
        elif args[0] == "move":
            self.cmd_wp_move(args[1:])
        elif args[0] == "movemulti":
            self.cmd_wp_movemulti(args[1:], None)
        elif args[0] == "changealt":
            self.cmd_wp_changealt(args[1:])
        elif args[0] == "param":
            self.cmd_wp_param(args[1:])
        elif args[0] == "remove":
            self.cmd_wp_remove(args[1:])
        elif args[0] == "undo":
            self.cmd_wp_undo()
        elif args[0] == "set":
            if len(args) != 2:
                print("usage: wp set <wpindex>")
                return
            self.master.waypoint_set_current_send(int(args[1]))
        elif args[0] == "clear":
            self.master.waypoint_clear_all_send()
            self.wploader.clear()
        elif args[0] == "editor":
            if self.module('misseditor'):
                self.mpstate.functions.process_stdin("module reload misseditor", immediate=True)
            else:
                self.mpstate.functions.process_stdin("module load misseditor", immediate=True)
        elif args[0] == "draw":
            if not 'draw_lines' in self.mpstate.map_functions:
                print("No map drawing available")
                return
            if self.get_home() is None:
                print("Need home location - please run gethome")
                return
            if len(args) > 1:
                self.settings.wpalt = int(args[1])
            self.mpstate.map_functions['draw_lines'](self.wp_draw_callback)
            print("Drawing waypoints on map at altitude %d" % self.settings.wpalt)
        elif args[0] == "sethome":
            self.set_home_location()
        elif args[0] == "loop":
            self.wp_loop()
        elif args[0] == "noflyadd":
            self.nofly_add()
        elif args[0] == "status":
            self.wp_status()
        elif args[0] == "slope":
            self.wp_slope()
        else:
            print(usage)
482633
def cli():
    """"""
    parser = get_argparser()

    args = parser.parse_args()
    check_args(args)
    if args.v:
        print('ERAlchemy version {}.'.format(__version__))
        exit(0)
    render_er(
        args.i,
        args.o,
        include_tables=args.include_tables,
        include_columns=args.include_columns,
        exclude_tables=args.exclude_tables,
        exclude_columns=args.exclude_columns,
        schema=args.s
    )
1034936
def cli(ctx, verbose, fake, install, uninstall, config):
    """"""
    # Create a repo object and remember it as as the context object.  From
    # this point onwards other commands can refer to it by using the
    # @pass_scm decorator.
    ctx.obj = SCMRepo()
    ctx.obj.fake = fake
    ctx.obj.verbose = fake or verbose

    if install:
        do_install(ctx, verbose, fake)
        ctx.exit()
    elif uninstall:
        do_uninstall(ctx, verbose, fake)
        ctx.exit()
    elif config:
        do_edit_settings(fake)
        ctx.exit()
    else:
        if ctx.invoked_subcommand is None:
            # Display help to user if no commands were passed.
            click.echo(format_help(ctx.get_help()))
490188
def cli(ctx, project_dir):
    """"""
    exit_code = SCons(project_dir).verify()
    ctx.exit(exit_code)
323649
protected function preUpdateArtisanCommands()
    {
        collect(config('self-update.artisan_commands.pre_update'))->every(function ($commandParams, $commandKey) {
            Artisan::call($commandKey, $commandParams['params']);
        });
    }
923745
protected function registerMakeCommand()
	{
		$this->app->bindShared('migration.creator', function($app)
		{
			return new MigrationCreator($app['files']);
		});

		$this->app->bindShared('command.migrate.make', function($app)
		{
			// Once we have the migration creator registered, we will create the command
			// and inject the creator. The creator is responsible for the actual file
			// creation of the migrations, and may be extended by these developers.
			$creator = $app['migration.creator'];

			$packagePath = $app['path.base'].'/vendor';

			return new MigrateMakeCommand($creator, $packagePath);
		});
	}
1231683
function run()
    {
        switch ($this->cmd) {
            case 'generate':
                return $this->cmdGenerate();
                break;

            case 'list':
                return $this->cmdList();
                break;

            default:
                echo "\n\n  Command \"key:".$this->cmd."\" not exists!";
                exit(Main::help());
                break;
        }
        return;
    }
646779
private function createFromCommand()
    {
        $command = TagCommand::getInstance($this->getRepository())->listTags();
        $outputLines = $this->getCaller()->execute($command, true, $this->getRepository()->getPath())->getOutputLines();
        $this->parseOutputLines($outputLines);
    }
323569
def cli(self, *args, **kwargs):
        """"""
        kwargs['api'] = self.api
        return cli(*args, **kwargs)
611624
public function run(string $command) : Process {
        $mutedCommand = Str::startsWith($command, 'artisan')
            ? str_replace('artisan ', '', $command)
            : $command;

        ignore_user_abort();

        $logName    = explode(' -', $mutedCommand, 2)[0];
        $log        = storage_path('logs' . DIRECTORY_SEPARATOR . snake_case(Str::slug($logName)) . '.log');
        $rootPath   = base_path();

        shell_exec("cd $rootPath && php artisan $mutedCommand >> " . $log . " &");

        exec('pgrep php', $processIds);
        exec('ps ahxwwo pid:1,command:1 | grep php | grep -v grep | grep -v emacs', $processes);

        $this->check();

        return $this->getProcessByCommand($command);
    }
580403
def cli(ctx):
    """"""
    json_path = os.path.join(os.path.expanduser('~'), '.keep', 'commands.json')
    if not os.path.exists(json_path):
        click.echo('No commands to show. Add one by `keep new`.')
    else:
        utils.list_commands(ctx)
1043013
def run(self, argv):
        """"""
        command = argv[0]
        handlers = { 
            'clean': self.clean,
            'create': self.create,
            'disable': self.disable,
            'enable': self.enable,
            'list': self.list,
            'update': self.update,
        }
        handler = handlers.get(command, None)
        if handler is None:
            error("Unrecognized command: %s" % command, 2)
        handler(argv[1:])
381986
def create(cli, command, docker_id):
        """"""
        content = waybill_template.format(command=command,
                                          docker_id=docker_id)
        waybill_dir = cli.get_waybill_dir()
        waybill_filename = os.path.join(waybill_dir, command + '.waybill')
        with open(waybill_filename, 'wb') as filehandle:
            filehandle.write(content)
        cli.log.info('Created waybill {0}'.format(waybill_filename))
1008278
def cli():
    """"""
    parser = argparse.ArgumentParser()
    parser.add_argument('api', help="""
        API to call.
        One one of 'article', 'frontpage', 'product', 'image', 'analyze', or
        'discussion'.
    """)
    parser.add_argument('url', help="""
        URL to pass as the 'url' parameter.
    """)
    parser.add_argument('token', help="""
        API key (token).
        Get one at https://www.diffbot.com/.
    """)
    parser.add_argument('-a', '--all', help="""
        Request all fields.
    """, action='store_true')
    parser.add_argument('-f', '--file', help="""
        File to read data from.
        Use '-' to read from STDIN.
    """)
    fields = text = html = None
    _args = parser.parse_args()
    if _args.all:
        fields = '*'
    if _args.file == '-':
        text = sys.stdin.read()
    elif _args.file:
        with open(_args.file, 'rb') as src:
            if os.path.splitext(_args.file)[1] in ('.html', '.htm'):
                html = src.read().decode(ENCODING)
            else:
                text = src.read().decode(ENCODING)
    print(json.dumps((api(_args.api, _args.url, _args.token,
                          html=html or None,
                          text=text or None,
                          fields=fields)),
                     sort_keys=True,
                     indent=2))