/** * Встроенная комманда help реализует отображение справочной информации. * * Если передедан необязательный параметр $command отображается справка * подкомманды. * * @param string $command * @return int 0 */ protected function cmdHelp($command = null) { $help = $this->parseHelpFile(); $subCommands = is_null($command) ? $this->getCommands() : array(); if (!is_null($command)) { $help = $help['inclass'][$command]; } IO::out($help['short']); if (!empty($help['main'])) { IO::out($help['main']); } $list = array(); foreach ($subCommands as $subCmd) { $i = $this->getCommandInfo($subCmd); $list[$subCmd] = trim($i['help']['short']); } if (isset($help['inclass']) && count($help['inclass'])) { foreach ($help['inclass'] as $inCmd => $v) { $list[$inCmd] = trim($v['short']); } } if (count($list)) { ksort($list, SORT_STRING); IO::out("~WHITE~Commands~~~:"); IO::outOptions($list); IO::out(); } // Command Options if (isset($help['options']) && count($help['options'])) { io::out('~WHITE~Options~~~:'); io::outOptions($help['options']); io::out(); } // Common IO Help IO::out(IO::help()); return 0; }
public function cmdInfo() { if (($login = ArgsHolder::get()->shiftCommand()) === false) { return io::out('Incorrect param count', IO::MESSAGE_FAIL) | 1; } try { $user = null; if (is_numeric($login)) { $user = User::findBy('id', $login); } elseif (!($user = User::findBy('login', $login))) { $user = User::findBy('email', $login); } if ($user) { //$p=new Profile($id); IO::out(""); IO::out("~WHITE~User Info~~~:"); $info = array('Id' => $user->getId(), 'Login' => $user->getLogin(), 'E-mail' => $user->getEmail(), 'State' => $user->getState() == "banned" ? '~RED~Banned~~~' : ($user->getState() == "active" ? '~GREEN~Active~~~' : '~CYAN~Deleted~~~')); /*What is this ? if (IO::getVerboseLevel()> IO::MESSAGE_TEXT){ $info[''] = ''; $info['~WHITE~CasseaUserManager~~~'] = ''; }*/ $info['Joined'] = $user->getDateJoined(); $info['Last seen'] = ($l = $user->getLastLogin()) != '0000-00-00 00:00:00' ? $l : 'never'; IO::outOptions($info); //TODO SHow user profile } else { return io::out('There is no user ~WHITE~' . $login . '~~~', IO::MESSAGE_FAIL) | 2; } } catch (UserException $e) { return io::out($e->getMessage(), IO::MESSAGE_FAIL) | 127; } }