module:shell
- Description:
Shell command interface for
bkshRun
bksh -helpto see all registered shell commands.Special global command-line arguments:
-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
Shell functions must be defined in
shell.commandsobject, wheremyCommandis the command name in camel case for-my-commandThe function may return special values:
stop- stop processing commands and create REPLcontinue- 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
- Source:
Example
const { shell } = require("backendjs");
shell.commands.myCommand = function(options) {
console.log("hello");
return "continue"
}
// Calling `bksh -my-command` it will run this command.