feat: add complate function
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
b3539d419e
commit
47048a5b1b
@ -29,6 +29,17 @@ client.on('end', (resone) => {
|
|||||||
const rl = createInterface({
|
const rl = createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout,
|
output: process.stdout,
|
||||||
|
completer: (line, func) => {
|
||||||
|
let args = line.split(' ')
|
||||||
|
let comp = args[args.length - 1]
|
||||||
|
client.once('tab_complete', (msg) => {
|
||||||
|
let mcts = msg.matches.filter(s => s)
|
||||||
|
func(null, [mcts, comp])
|
||||||
|
})
|
||||||
|
client.write('tab_complete', {
|
||||||
|
text: line
|
||||||
|
})
|
||||||
|
},
|
||||||
terminal: true,
|
terminal: true,
|
||||||
prompt: ''
|
prompt: ''
|
||||||
})
|
})
|
||||||
@ -37,11 +48,10 @@ rl.on('line', function(line) {
|
|||||||
switch (line) {
|
switch (line) {
|
||||||
case "":
|
case "":
|
||||||
break;
|
break;
|
||||||
|
case "write":
|
||||||
|
break;
|
||||||
case "/respawn":
|
case "/respawn":
|
||||||
client.write('client_command', { payload: 0 })
|
client.write('client_command', { payload: 0 })
|
||||||
// client.write("respawn", {
|
|
||||||
|
|
||||||
// })
|
|
||||||
break;
|
break;
|
||||||
case "//reco":
|
case "//reco":
|
||||||
client.end("")
|
client.end("")
|
||||||
|
Loading…
Reference in New Issue
Block a user