INNER CODE UNIT · JavaScript

usageError

aeonfun/opendia · opendia-mcp/server.js:18

function usageError(message) {
  console.error(`❌ ${message}`);
  process.exit(1);
}

// Returns the text after `=`, or null when the flag is absent. An empty value
// (`--token=`) is a usage error, not an empty string: treating it as falsy is
// what let `--token=` disable auth outright and `--http-host=` bind 0.0.0.0.
function argValue(name) {
  const flag = args.find(arg => arg.startsWith(`${name}=`));
  if (flag === undefined) return null;
  const value = flag.slice(name.length + 1);
  if (value === '') usageError(`${name}= requires a value`);
  return value;
}

// Digits only — Number() would accept '0x1f' and parseInt() would accept '80abc'.
function portValue(name) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…