Example #1
0
  private registerConsoleCommands() {
    this.embark.registerConsoleCommand({
      description: __("Start or stop the API"),
      matches: ["api start"],
      process: (cmd: string, callback: () => void) => {
        this.embark.events.request("api:start", callback);
      },
      usage: "api start/stop",
    });

    this.embark.registerConsoleCommand({
      matches: ["api stop"],
      process: (cmd: string, callback: () => void) => {
        this.embark.events.request("api:stop", callback);
      },
    });

    this.embark.registerConsoleCommand({
      matches: ["log api on"],
      process: (cmd: string, callback: () => void) => {
        this.embark.events.request("logs:api:enable", callback);
      },
    });

    this.embark.registerConsoleCommand({
      matches: ["log api off"],
      process: (cmd: string, callback: () => void) => {
        this.embark.events.request("logs:api:disable", callback);
      },
    });
  }
Example #2
0
 private registerConsoleCommands() {
   this.embark.registerConsoleCommand({
     description: __("display console commands history"),
     matches: (cmd: string) => {
       const [cmdName] = cmd.split(" ");
       return cmdName === "history";
     },
     process: (cmd: string, callback: any) => {
       const [_cmdName, length] = cmd.split(" ");
       this.getHistory(length, callback);
     },
     usage: "history [optionalLength]",
   });
 }