Skip to content

Создание команды

ndr-power edited this page Jan 8, 2018 · 2 revisions

Создание команды; Command creation

Команда имеет вид; Command's structure:

const command = {
    description: 'Description of the command', //Описание для команды "help"; Description for the "help" command
    usage: 'command', //Как использовать. Для команды "help command"; Usage for the "help <command>"
    run(suffix, api, res) { //Главная функция; Main function
      f.stdio.writeLine("Hello world!"); //Вывести текст "Hello world" на экран; Display "Hello world" on the screen
      return res(0); //Конец (res(1) если возникла ошибка); End (res(1) if was error)
    }
  }

И задается так; And it could be defined like this:

$$.shell.setCommand("name", command);