MCPcopy
hub / github.com/tj/commander.js / _checkForMissingExecutable

Method _checkForMissingExecutable

lib/command.js:1196–1207  ·  view source on GitHub ↗

* Throw if expected executable is missing. Add lots of help for author. * * @param {string} executableFile * @param {string} executableDir * @param {string} subcommandName

(executableFile, executableDir, subcommandName)

Source from the content-addressed store, hash-verified

1194 * @param {string} subcommandName
1195 */
1196 _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
1197 if (fs.existsSync(executableFile)) return;
1198
1199 const executableDirMessage = executableDir
1200 ? `searched for local subcommand relative to directory '${executableDir}'`
1201 : 'no directory for search for local subcommand, use .executableDir() to supply a custom directory';
1202 const executableMissing = `'${executableFile}' does not exist
1203 - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
1204 - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1205 - ${executableDirMessage}`;
1206 throw new Error(executableMissing);
1207 }
1208
1209 /**
1210 * Execute a sub-command executable.

Callers 1

_executeSubCommandMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected