Creates an admin user
@param Arguments $args The command arguments
@param ConsoleIo $io The console io
@return null|int The exit code or null for success
6802
public function execute(Arguments $args, ConsoleIo $io)
    {
        $command = new AddUserCommand;

        return $command->run(['--group', 1] + $args->getOptions(), $io);
    }
1040150
public function cli(InputInterface $input = null, OutputInterface $output = null)
  {
    $input = $input ?? new ArgvInput();
    $output = $output ?? new ConsoleOutput();

    $console = $this->getConsole();
    $this->_eventChannel->trigger(ConsolePrepareEvent::i($this->getContext(), $console, $input, $output));

    try
    {
      $exitCode = $console->run($input, $output);
    }
    catch(\Throwable $e)
    {
      $output->writeln("GENERIC EXCEPTION : " . $e->getCode());
      $output->writeln($e->getMessage());
      $exitCode = 1;
    }

    return $exitCode > 255 ? 255 : $exitCode;
  }
352024
private static PrincipalUser createAdminUser() {
        PrincipalUser result = new PrincipalUser("admin", "argus-admin@salesforce.com");

        result.id = BigInteger.ONE;
        result.setPrivileged(true);
        return result;
    }
435287
public function execute(Arguments $args, ConsoleIo $io)
    {
        $io->out(Configure::version());

        return static::CODE_SUCCESS;
    }
1282057
private function createAdminUser(InputInterface $input, OutputInterface $output)
    {
        $arguments = [];

        $arguments['command'] = 'fos:user:create';

        if ($input->getOption('username')) {
            $arguments['username'] = $input->getOption('username');
        }
        if ($input->getOption('email')) {
            $arguments['email'] = $input->getOption('email');
        }
        if ($input->getOption('password')) {
            $arguments['password'] = $input->getOption('password');
        }
        $command = $this->getApplication()->find('fos:user:create');

        $arguments['--super-admin'] = true;

        $input = new ArrayInput($arguments);

        return $command->run($input, $output);
    }
1257117
public function execute(Arguments $args, ConsoleIo $io)
    {
        $file = Folder::slashTerm(WWW_ROOT) . 'vendor' . DS . 'kcfinder' . DS . '.htaccess';

        if ($this->verboseIfFileExists($io, $file)) {
        } elseif ((new KCFinder)->isAvailable()) {
            $io->createFile(
                Folder::slashTerm(WWW_ROOT) . 'vendor' . DS . 'kcfinder' . DS . '.htaccess',
                'php_value session.cache_limiter must-revalidate' . PHP_EOL .
                'php_value session.cookie_httponly On' . PHP_EOL .
                'php_value session.cookie_lifetime 14400' . PHP_EOL .
                'php_value session.gc_maxlifetime 14400' . PHP_EOL .
                'php_value session.name CAKEPHP'
            );
        } else {
            $io->error(__d('me_tools', '{0} is not available', 'KCFinder'));
        }

        return null;
    }
141558
protected function execute(InputInterface $input, OutputInterface $output): ?int
    {
        $username = $this->getUsername($input, $output);
        if ($input->getOption('if-not-exists')) {
            try {
                $user = $this->userManager->loadUserByUsername($username);
            } catch (\Exception $e) {
                $user = null;
            }
            if ($user) {
                $message = $this->translator->trans(
                    'user.already_exists',
                    [
                        '%username%' => $username,
                    ],
                    'security'
                );
                $output->writeln("<comment>{$message}</comment>");

                return 0;
            }
        }

        try {
            $user = $this->userManager->createUser($username);
        } catch (BadUsernameException $e) {
            $output->writeln("<error>{$e->getMessage()}</error>");

            return 1;
        }

        $user->setSuperAdmin($input->getOption('admin'));
        $password = $this->getPassword($input, $output);
        if ($password) {
            $this->userManager->setPlainTextPassword($user, $password);
        }
        $this->userManager->save($user);

        $message = $this->translator->trans('user.created_success', ['%username%' => $username], 'security');
        $output->writeln("<info>{$message}</info>");

        return 0;
    }
211159
public function execute(Arguments $args, ConsoleIo $io) {
		$syncer = $this->getSyncer();
		$syncer->syncAcl($args, $io);
		$io->out('Controllers and ACL synced.');

		return static::CODE_SUCCESS;
	}
1024779
public function execute(Arguments $args, ConsoleIo $io)
    {
        foreach (Configure::read('VENDOR_LINKS') as $origin => $target) {
            $this->createLink(
                $io,
                Folder::slashTerm(ROOT) . 'vendor' . DS . $origin,
                Folder::slashTerm(WWW_ROOT) . 'vendor' . DS . $target
            );
        }

        return null;
    }
790519
function cmd_confirm(args, done) {
    var seneca = this
    var why
    var userent = seneca.make(user_canon)

    userent.load$({ confirmcode: args.code }, function(err, user) {
      if (err) return done(err)

      if (user) {
        if (user.active) {
          user.confirmed = true
          user.save$(function(err, user) {
            if (err) return done(err)
            done(null, { ok: true, user: user })
          })
        } else {
          seneca.log.debug(
            'confirm/fail',
            (why = 'not-active'),
            args.code,
            user
          )
          return done(null, { ok: false, why: why, user: user })
        }
      } else {
        seneca.log.debug(
          'confirm/fail',
          (why = 'invalid-code'),
          args.code,
          user
        )
        return done(null, { ok: false, why: why })
      }
    })
  }
994406
public function execute(array $args, array $options = array())
    {
        if (!count($args)) {
            throw new ConsoleException("Missing subcommand name");
        }
        
        $command = ucfirst(Utils::camelize(array_shift($args)));
        $methodName = "execute$command";
        if (!method_exists($this, $methodName)) {
            throw new ConsoleException("Command '$command' does not exist");
        }

        $method = new ReflectionMethod($this, $methodName);
        $params = Utils::computeFuncParams($method, $args, $options);
        return $method->invokeArgs($this, $params);
    }
1130316
protected function startingMessage(ConsoleIO $io, $packageName, $siteDir)
    {
        $io->newLine();
        $io->write(sprintf(
            '<comment>Installing theme: "%s" in "%s" folder</comment>',
            $packageName,
            $siteDir
        ));
        $io->newLine();
    }
675382
public static function adminInit( $callback, $priority = null, $accepted_args = null ) {
		self::action( 'admin_init', $callback, $priority, $accepted_args );
	}
1043682
protected function displayHelp(ConsoleOptionParser $parser, Arguments $args, ConsoleIo $io)
    {
        $format = 'text';
        if ($args->getArgumentAt(0) === 'xml') {
            $format = 'xml';
            $io->setOutputAs(ConsoleOutput::RAW);
        }

        $io->out($parser->help(null, $format));
    }
999581
public function executeHello(array $args, array $options = array())
    {
        $name = 'unknown';
        if (empty($args)) {
            $dialog = new Dialog($this->console);
            $name = $dialog->ask('What is your name?', $name);
        } else {
            $name = $args[0];
        }
        $this->writeln(sprintf('hello %s!', $name));
    }
1094725
public function handleList(Args $args, IO $io)
    {
        $raw = !$args->isOptionSet('parsed');
        $userValues = $this->manager->getConfigKeys(false, false, $raw);
        $effectiveValues = $this->manager->getConfigKeys(true, true, $raw);

        $table = new Table(PuliTableStyle::borderless());
        $table->setHeaderRow(array('Config Key', 'User Value', 'Effective Value'));

        foreach ($effectiveValues as $key => $value) {
            $table->addRow(array(
                sprintf('<c1>%s</c1>', $key),
                array_key_exists($key, $userValues)
                    ? StringUtil::formatValue($userValues[$key], false)
                    : '',
                StringUtil::formatValue($value, false),
            ));
        }

        $table->render($io);

        return 0;
    }
516156
public function io(Interactor $io = null)
    {
        if ($io || !$this->io) {
            $this->io = $io ?? new Interactor;
        }

        if (\func_num_args() === 0) {
            return $this->io;
        }

        return $this;
    }