Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
feat: add new redis command support
Browse files Browse the repository at this point in the history
  • Loading branch information
pikadun committed May 6, 2021
1 parent 2df1466 commit 24abfb9
Show file tree
Hide file tree
Showing 5 changed files with 526 additions and 409 deletions.
16 changes: 13 additions & 3 deletions eng/gencmd.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { readFileSync } from 'fs';
import { writeFileSync } from 'fs';
import { resolve } from 'path';
import { ClientV3 } from '../';

const jsonPath = resolve(__dirname, '..', 'src', 'command', 'commands.json');
const dtsPath = resolve(__dirname, '..', 'src', 'command', 'baseCommand.ts');
Expand All @@ -10,11 +12,19 @@ const dtsBase = readFileSync(dtsPath).toString();
const dtsV2 = readFileSync(dtsPathV2).toString();
const dtsV3 = readFileSync(dtsPathV3).toString();

const redis = new ClientV3();

const notInCommands = ['zscan', 'quit'];

async function dodo() {
const redisCommands: string[] = JSON.parse(readFileSync(jsonPath).toString());
redisCommands.forEach(cmdText => {
checkDTS(cmdText);
const redisCommands = await redis.COMMAND<[string][]>();
const commands = redisCommands.filter(rc => rc instanceof Array).map(rc => rc[0]);
commands.push(...notInCommands);
commands.sort();
writeFileSync(jsonPath, JSON.stringify(commands, undefined, '\u0020\u0020\u0020\u0020'));

commands.forEach(cmdText => {
checkDTS(cmdText);
});
process.exit(0);
}
Expand Down
Loading

0 comments on commit 24abfb9

Please sign in to comment.