shell

(require("shell"))()

Description:
  • Shell command interface for bksh

    Run bksh -help to see all registered shell commands.

    Special command-lone arguments for shell commands:

    • -noexit - keep the shell running after executing the command
    • -exit - exit with error if no shell command found
    • -exit-timeout MS - will be set to ms to wait before exit for async actions to finish
    • -shell-delay MS - will wait before running the command to allow initialization complete

Type Definitions

shellCommand(options) → {string}

Description:
  • Shell functions must be defined in shell.commands object, where myCommand is the command name in camel case for -my-command

Parameters:
Name Type Description
options object
Returns:
Type Description
string
  • stop - stop processing commands and create REPL
  • continue - do not exit and continue processing other commands or end with REPL

all other values will result in returning from the run assuming the command will decide what to do, exit or continue running, no REPL is created

Example
const { shell } = require("backendjs");

shell.commands.myCommand = function(options) {
   console.log("hello");
   return "continue"
}
// Calling `bksh -my-command` it will run this command.