`commandCompletion` uses `trialCommand.substr(0,command.length)`. Should use `substring`.
commandCompletionusestrialCommand.substr(0,command.length). Should usesubstring.