mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
repl: fix tab completion for defined commands
PR-URL: https://github.com/nodejs/node/pull/7364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
1 parent
71ef71cff8
commit
c8e9adb135
2 files changed
+9
-2
No files matched your search
+2
-2
@@ -659,11 +659,11 @@ REPLServer.prototype.complete = function(line, callback) {
|
||||
|
||||
// REPL commands (e.g. ".break").
|
||||
var match = null;
|
||||
match = line.match(/^\s*(\.\w*)$/);
|
||||
match = line.match(/^\s*\.(\w*)$/);
|
||||
if (match) {
|
||||
completionGroups.push(Object.keys(this.commands));
|
||||
completeOn = match[1];
|
||||
if (match[1].length > 1) {
|
||||
if (match[1].length) {
|
||||
filter = match[1];
|
||||
}
|
||||
|
||||
|
||||
@@ -306,3 +306,10 @@ putIn.run(['var obj = {1:"a","1a":"b",a:"b"};']);
|
||||
testMe.complete('obj.', common.mustCall(function(error, data) {
|
||||
assert.deepEqual(data, obj_elements);
|
||||
}));
|
||||
|
||||
// tab completion for defined commands
|
||||
putIn.run(['.clear']);
|
||||
|
||||
testMe.complete('.b', common.mustCall((error, data) => {
|
||||
assert.deepStrictEqual(data, [['break'], 'b']);
|
||||
}));
|
||||
Reference in new issue
Block a user