Initial implementation of custom commands feature (e.g. telnet).

This commit is contained in:
Zaid Abdulla committed 2013-09-10 15:54:09 +03:00
1 parent 3c7f554264
commit ff286080e8
5 files changed
+63 -2

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
common = require './common'
exports.execute = (deviceId, command, callback) ->
args = command.split(/\s+/)
f = args.shift()
c = args.shift()
file = require "./config/custom_commands/#{f}"
file[c](deviceId, args.join(' '), callback)
exports.getCommands = (filename) ->
commands = []
f = require("./config/custom_commands/#{filename}")
for k,v of f
commands.push(k)
return commands