Options
All
  • Public
  • Public/Protected
  • All
Menu

pinus-cli

Index

Variables

client

client: AdminClient = null

commandId

commandId: string = "config"

context

context: string = "all"

helpCommand

helpCommand: string = "help config"

host

host: any = argv['h'] = argv['h'] || 'localhost'

logger

logger: Logger = getLogger(__filename)

password

password: any = argv['p'] = argv['p'] || 'monitor'

port

port: any = argv['P'] = argv['P'] || 3005

serverMap

serverMap: object

Type declaration

  • [key: string]: any

username

username: any = argv['u'] = argv['u'] || 'monitor'

Functions

argsFilter

  • argsFilter(argv: string): string[]
  • Parameters

    • argv: string

    Returns string[]

completer

  • completer(line: string): (string | any[])[]
  • Parameters

    • line: string

    Returns (string | any[])[]

default

doConnect

  • doConnect(): void

errorHandle

  • errorHandle(comd: string, rl: ReadLine): void
  • Parameters

    • comd: string
    • rl: ReadLine

    Returns void

formatOutput

  • formatOutput(comd: string, data: object): void
  • Parameters

    • comd: string
    • data: object
      • msg: object
        • [key: string]: any

    Returns void

format_date

  • format_date(date: Date, friendly?: boolean): string
  • Parameters

    • date: Date
    • Optional friendly: boolean

    Returns string

getColor

  • getColor(len: number): string[]
  • Parameters

    • len: number

    Returns string[]

help

  • help(): void
  • help(): void

log

  • log(str: string): void
  • Parameters

    • str: string

    Returns void

md5

  • md5(str: string): string
  • Parameters

    • str: string

    Returns string

startCli

  • startCli(): void

tabComplete

  • tabComplete(hits: Array<any>, line: string, map: object, comd: string): any[]
  • Parameters

    • hits: Array<any>
    • line: string
    • map: object
    • comd: string

    Returns any[]

Object literals

consts

consts: object

ADDCRON_QUESTION_INFO

ADDCRON_QUESTION_INFO: string = "warning : do you really want to add this cron [yes/no] "

ADD_QUESTION_INFO

ADD_QUESTION_INFO: string = "warning : do you really want to add this server [yes/no] "

ASCII_LOGO

ASCII_LOGO: string[] = [".__________________.","| |","| PINUS |","|__________________|",]

BLACKLIST_QUESTION_INFO

BLACKLIST_QUESTION_INFO: string = "warning : do you really want to add this blacklist [yes/no] "

COMANDS_ADD_ERROR

COMANDS_ADD_ERROR: string = "add command error"

COMANDS_ALL

COMANDS_ALL: string[][] = [["command", " description"],["?", " symbol for help"],["help", " display the help"],["quit", " quit pinus-cli"],["kill", " kill all servers"],["exec", " exec script files"],["get", " equal to app.get(key) "],["set", " equal to app.set(key, value)"],["add", " add server to pinus clusters"],["stop", " stop server. Takes serverId as argument"],["show", " show infos like : user, servers, connections"],["use", " use another server. Takes serverId as argument"],["enable", " enable an admin console module or enable app settings"],["disable", " disable an admin console module or disable app settings"],["dump", " make a dump of the V8 heap and cpu for later inspection"],["addCron", " add cron for server"],["removeCron", " remove cron for server"],["blacklist", " add blacklist for frontend server"],["run", " run script in server"]]

COMANDS_COMPLETE

COMANDS_COMPLETE: string[] = ["help", "quit", "kill", "exec", "get", "set","add", "stop", "show", "use", "enable", "disable", "dump", "addCron", "removeCron"]

COMANDS_CONFIG_ERROR

COMANDS_CONFIG_ERROR: string = "config command error"

COMANDS_CONTEXT_ERROR

COMANDS_CONTEXT_ERROR: string = "this command is not used in this contextyou can use command 'use' to switch context"

COMANDS_DISABLE_ERROR

COMANDS_DISABLE_ERROR: string = "disable command error"

COMANDS_ENABLE_ERROR

COMANDS_ENABLE_ERROR: string = "enable command error"

COMANDS_ERROR

COMANDS_ERROR: string = "this command is error format"

COMANDS_EXEC_ERROR

COMANDS_EXEC_ERROR: string = "exec command script filepath error"

COMANDS_KILL_ERROR

COMANDS_KILL_ERROR: string = "kill command error"

COMANDS_SHOW_ERROR

COMANDS_SHOW_ERROR: string = "show command error"

COMANDS_STOP_ERROR

COMANDS_STOP_ERROR: string = "stop command error"

COMANDS_USE_ERROR

COMANDS_USE_ERROR: string = "use command error"

COMPONENTS_INFO

COMPONENTS_INFO: string = "there are following components registered in current server"

CONSOLE_MODULE

CONSOLE_MODULE: string = "__console__"

HELP_INFO_1

HELP_INFO_1: string[] = ["\nFor information about Pinus products and services, visit:"," https://pinus.io/","\nList of all Pinus commands:\n"]

HELP_INFO_2

HELP_INFO_2: string[] = ["\nFor more command usage, type : help command","example: help show\n"]

HELP_LOGIN

HELP_LOGIN: string[] = ["\nWelcome to Pinus interactive client.","Pinus is a fast, scalable game server framework for node.js. ","You can use following command to connect to pinus master","pinus-cli -h host -P port -u user -p password","Default type pinus-cli equals to:","pinus-cli -h 127.0.0.1 -P 3005 -u admin -p admin\n"]

KILL_QUESTION_INFO

KILL_QUESTION_INFO: string = "warning : do you really want to kill all servers [yes/no] "

MODULE_INFO

MODULE_INFO: string = "there are following modules registered in pinus clusters"

PROMPT

PROMPT: string = "@pinus : "

STATUS_ERROR

STATUS_ERROR: string = "can not get status in this server"

STOP_QUESTION_INFO

STOP_QUESTION_INFO: string = "warning : do you really want to stop this server [yes/no] "

WELCOME_INFO

WELCOME_INFO: string[] = ["\nWelcome to Pinus interactive client.","Pinus is a fast, scalable game server framework for node.js. ","Type \'help\' for more information.\n"]

COMANDS_COMPLETE_INFO

COMANDS_COMPLETE_INFO: object

add

add: number = 1

addCron

addCron: number = 1

blacklist

blacklist: number = 1

disable

disable: number = 1

dump

dump: number = 1

enable

enable: number = 1

exec

exec: number = 1

get

get: number = 1

help

help: number = 1

kill

kill: number = 1

removeCron

removeCron: number = 1

run

run: number = 1

set

set: number = 1

show

show: number = 1

stop

stop: number = 1

use

use: number = 1

COMANDS_MAP

COMANDS_MAP: object

add

add: string[] = ["\nadd server to pinus clusters","add args are key=value from servers.json config files","example: add host=127.0.0.1 port=3451 serverType=chat id=chat-server-2","example: add host=127.0.0.1 port=3152 serverType=connector id=connector-server-3 clientPort=3012 frontend=true\n",]

addCron

addCron: string[] = ["\nadd cron for server","addCron args are key=value from crons.json config files","example: addCron id=8 serverId=chat-server-1 'time=0 30 10 * * *' action=chatCron.send","example: addCron id=8 serverType=chat 'time=0 30 10 * * *' action=chatCron.send\n"]

blacklist

blacklist: string[] = ["\nadd blacklist for frontend server","example: blacklist 192.168.10.120 192.168.18.60","example: blacklist \b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b"]

config

config: string[] = ["\nconfig infos like : proxy, remote, connection, connector, session","you can show following informations:","proxy, remote, connection, connector, session, protobuf","localSession, channel, server, scheduler, globalChannel, monitor","example: show config proxy","example: show config remote","example: show config connection","note: show config xxx command show configuration from app.get(\'xxxConfig\')","in pinus you can pass opt config to component to make your like-style server","but you should keep in mind to use it in a proper context\n"]

disable

disable: string[] = ["\ndisable an admin console module or disable app settings","disable module <moduleId>","disable app <settings>","example: disable module systemInfo","example: disable app systemMonitor\n"]

dump

dump: string[] = ["\nmake a dump of the V8 heap and cpu for later inspection","dump cpu|memory <filepath> [times] [--force]","times is the number of cpu dump costs in seconds","example: dump cpu /home/xxx/test 5","example: dump memory /home/xxx/test","note: you can add --force to write dump file if file existed","example: dump cpu /home/xxx/test 5 --force","example: dump memory /home/xxx/test --force\n"]

enable

enable: string[] = ["\nenable an admin console module or enable app settings","enable module <moduleId>","enable app <settings>","example: enable module systemInfo","example: enable app systemMonitor\n",]

exec

exec: string[] = ["\nexec script files","example: exec <filepath>","filepath can be relative path to your pinus-cli pwd path","example : exec xxx.js","equals to : exec pwd/xxx.js","filepath also can be absolute with \'/\' ahead","example : exec /home/user/xxx.js\n"]

get

get: string[] = ["\nequal to app.get(key)","example: get <key>\n"]

help

help: number = 1

kill

kill: string[] = ["\nkill all servers.","example: kill","note: be carefull to use this command\n"]

removeCron

removeCron: string[] = ["\nremove cron for server","example: removeCron id=8 serverId=chat-server-1","example: removeCron id=8 serverType=chat"]

run

run: string[] = ["\nrun script in server","example: run app.get(\"sessionService\").getSessionsCount()","example: run app.isMaster()"]

set

set: string[] = ["\nequal to app.set(key, value)","example: set <key> <value>","note: value must be string\n"]

show

show: string[] = ["\nshow infos like : servers, connections","you can show following informations:","servers, connections, logins, modules, status, proxy, handler, components, settings","example: show servers","example: show connections","example: show proxy","example: show handler","example: show logins\n"]

stop

stop: string[] = ["\nstop server. takes serverId as argument.","stop <serverId>","example: stop area-server-1\n"]

use

use: string[] = ["\nuse another server. takes serverId|all as argument","use <serverId>|all","then you will switch to serverId|all context","your command will be applied to serverId|all server","example: use area-server-1","example: use all\n"]

COMPLETE_TWO

COMPLETE_TWO: object

disable

disable: number = 1

dump

dump: number = 1

enable

enable: number = 1

help

help: number = 1

show

show: number = 1

CONTEXT_COMMAND

CONTEXT_COMMAND: object

components

components: number = 1

disable

disable: number = 1

enable

enable: number = 1

handler

handler: number = 1

logins

logins: number = 1

proxy

proxy: number = 1

settings

settings: number = 1

status

status: number = 1

SHOW_COMMAND

SHOW_COMMAND: object

components

components: number = 1

config

config: number = 1

connections

connections: number = 1

handler

handler: number = 1

logins

logins: number = 1

modules

modules: number = 1

proxy

proxy: number = 1

servers

servers: number = 1

settings

settings: number = 1

status

status: number = 1