Skip to content

Commit 2c091a5

Browse files
author
Ruben Bridgewater
committed
Properly fix quit command
1 parent 18da5e5 commit 2c091a5

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

commands.json

+11
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,17 @@
984984
"keyStop": 0,
985985
"step": 0
986986
},
987+
"quit": {
988+
"arity": 1,
989+
"flags": [
990+
"loading",
991+
"stale",
992+
"readonly"
993+
],
994+
"keyStart": 0,
995+
"keyStop": 0,
996+
"step": 0
997+
},
987998
"randomkey": {
988999
"arity": 1,
9891000
"flags": [

index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ var commands = require('./commands');
1010
* @var {string[]}
1111
* @public
1212
*/
13-
var commandsList = Object.keys(commands);
14-
commandsList.push('quit');
15-
exports.list = commandsList;
13+
exports.list = Object.keys(commands);
1614

1715
/**
1816
* Check if the command has the flag

test/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ describe('redis-commands', function () {
3737
expect(commands.hasFlag('set', 'fast')).to.eql(false);
3838
expect(commands.hasFlag('set', 'readonly')).to.eql(false);
3939
expect(commands.hasFlag('select', 'denyoom')).to.eql(false);
40+
expect(commands.hasFlag('quit', 'denyoom')).to.eql(false);
4041
});
4142
});
4243

tools/build.js

+15
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ redis.command(function (err, res) {
2424
return prev;
2525
}, {});
2626

27+
// Future proof. Redis might implement this soon
28+
if (!commands.quit) {
29+
commands.quit = {
30+
arity: 1,
31+
flags: [
32+
'loading',
33+
'stale',
34+
'readonly'
35+
],
36+
keyStart: 0,
37+
keyStop: 0,
38+
step: 0
39+
}
40+
}
41+
2742
// Use json-stable-stringify instead fo JSON.stringify
2843
// for easier diffing
2944
var content = stringify(commands, { space: ' ' });

0 commit comments

Comments
 (0)