Skip to content

Commit 1a21a72

Browse files
committed
docs: generate list of all commands into readme #1313
1 parent 19c80c6 commit 1a21a72

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ and Boolean values will result in the value coerced to a string!
151151
# Redis Commands
152152

153153
This library is a 1 to 1 mapping to [Redis commands](https://redis.io/commands).
154-
It is not a cache library so please refer to Redis commands page for full usage
155-
details.
154+
It is not a cache library so please refer to Redis commands page for full usage details:
155+
156+
[append](https://redis.io/commands/append), [asking](https://redis.io/commands/asking), [auth](https://redis.io/commands/auth), [bgrewriteaof](https://redis.io/commands/bgrewriteaof), [bgsave](https://redis.io/commands/bgsave), [bitcount](https://redis.io/commands/bitcount), [bitfield](https://redis.io/commands/bitfield), [bitop](https://redis.io/commands/bitop), [bitpos](https://redis.io/commands/bitpos), [blpop](https://redis.io/commands/blpop), [brpop](https://redis.io/commands/brpop), [brpoplpush](https://redis.io/commands/brpoplpush), [client](https://redis.io/commands/client), [cluster](https://redis.io/commands/cluster), [command](https://redis.io/commands/command), [config](https://redis.io/commands/config), [dbsize](https://redis.io/commands/dbsize), [debug](https://redis.io/commands/debug), [decr](https://redis.io/commands/decr), [decrby](https://redis.io/commands/decrby), [del](https://redis.io/commands/del), [discard](https://redis.io/commands/discard), [dump](https://redis.io/commands/dump), [echo](https://redis.io/commands/echo), [eval](https://redis.io/commands/eval), [evalsha](https://redis.io/commands/evalsha), [exec](https://redis.io/commands/exec), [exists](https://redis.io/commands/exists), [expire](https://redis.io/commands/expire), [expireat](https://redis.io/commands/expireat), [flushall](https://redis.io/commands/flushall), [flushdb](https://redis.io/commands/flushdb), [geoadd](https://redis.io/commands/geoadd), [geodist](https://redis.io/commands/geodist), [geohash](https://redis.io/commands/geohash), [geopos](https://redis.io/commands/geopos), [georadius](https://redis.io/commands/georadius), [georadius_ro](https://redis.io/commands/georadius_ro), [georadiusbymember](https://redis.io/commands/georadiusbymember), [georadiusbymember_ro](https://redis.io/commands/georadiusbymember_ro), [get](https://redis.io/commands/get), [getbit](https://redis.io/commands/getbit), [getrange](https://redis.io/commands/getrange), [getset](https://redis.io/commands/getset), [hdel](https://redis.io/commands/hdel), [hexists](https://redis.io/commands/hexists), [hget](https://redis.io/commands/hget), [hgetall](https://redis.io/commands/hgetall), [hincrby](https://redis.io/commands/hincrby), [hincrbyfloat](https://redis.io/commands/hincrbyfloat), [hkeys](https://redis.io/commands/hkeys), [hlen](https://redis.io/commands/hlen), [hmget](https://redis.io/commands/hmget), [hmset](https://redis.io/commands/hmset), [host:](https://redis.io/commands/host:), [hscan](https://redis.io/commands/hscan), [hset](https://redis.io/commands/hset), [hsetnx](https://redis.io/commands/hsetnx), [hstrlen](https://redis.io/commands/hstrlen), [hvals](https://redis.io/commands/hvals), [incr](https://redis.io/commands/incr), [incrby](https://redis.io/commands/incrby), [incrbyfloat](https://redis.io/commands/incrbyfloat), [info](https://redis.io/commands/info), [keys](https://redis.io/commands/keys), [lastsave](https://redis.io/commands/lastsave), [latency](https://redis.io/commands/latency), [lindex](https://redis.io/commands/lindex), [linsert](https://redis.io/commands/linsert), [llen](https://redis.io/commands/llen), [lpop](https://redis.io/commands/lpop), [lpush](https://redis.io/commands/lpush), [lpushx](https://redis.io/commands/lpushx), [lrange](https://redis.io/commands/lrange), [lrem](https://redis.io/commands/lrem), [lset](https://redis.io/commands/lset), [ltrim](https://redis.io/commands/ltrim), [memory](https://redis.io/commands/memory), [mget](https://redis.io/commands/mget), [migrate](https://redis.io/commands/migrate), [module](https://redis.io/commands/module), [monitor](https://redis.io/commands/monitor), [move](https://redis.io/commands/move), [mset](https://redis.io/commands/mset), [msetnx](https://redis.io/commands/msetnx), [multi](https://redis.io/commands/multi), [object](https://redis.io/commands/object), [persist](https://redis.io/commands/persist), [pexpire](https://redis.io/commands/pexpire), [pexpireat](https://redis.io/commands/pexpireat), [pfadd](https://redis.io/commands/pfadd), [pfcount](https://redis.io/commands/pfcount), [pfdebug](https://redis.io/commands/pfdebug), [pfmerge](https://redis.io/commands/pfmerge), [pfselftest](https://redis.io/commands/pfselftest), [ping](https://redis.io/commands/ping), [post](https://redis.io/commands/post), [psetex](https://redis.io/commands/psetex), [psubscribe](https://redis.io/commands/psubscribe), [psync](https://redis.io/commands/psync), [pttl](https://redis.io/commands/pttl), [publish](https://redis.io/commands/publish), [pubsub](https://redis.io/commands/pubsub), [punsubscribe](https://redis.io/commands/punsubscribe), [quit](https://redis.io/commands/quit), [randomkey](https://redis.io/commands/randomkey), [readonly](https://redis.io/commands/readonly), [readwrite](https://redis.io/commands/readwrite), [rename](https://redis.io/commands/rename), [renamenx](https://redis.io/commands/renamenx), [replconf](https://redis.io/commands/replconf), [restore](https://redis.io/commands/restore), [restore-asking](https://redis.io/commands/restore-asking), [role](https://redis.io/commands/role), [rpop](https://redis.io/commands/rpop), [rpoplpush](https://redis.io/commands/rpoplpush), [rpush](https://redis.io/commands/rpush), [rpushx](https://redis.io/commands/rpushx), [sadd](https://redis.io/commands/sadd), [save](https://redis.io/commands/save), [scan](https://redis.io/commands/scan), [scard](https://redis.io/commands/scard), [script](https://redis.io/commands/script), [sdiff](https://redis.io/commands/sdiff), [sdiffstore](https://redis.io/commands/sdiffstore), [select](https://redis.io/commands/select), [set](https://redis.io/commands/set), [setbit](https://redis.io/commands/setbit), [setex](https://redis.io/commands/setex), [setnx](https://redis.io/commands/setnx), [setrange](https://redis.io/commands/setrange), [shutdown](https://redis.io/commands/shutdown), [sinter](https://redis.io/commands/sinter), [sinterstore](https://redis.io/commands/sinterstore), [sismember](https://redis.io/commands/sismember), [slaveof](https://redis.io/commands/slaveof), [slowlog](https://redis.io/commands/slowlog), [smembers](https://redis.io/commands/smembers), [smove](https://redis.io/commands/smove), [sort](https://redis.io/commands/sort), [spop](https://redis.io/commands/spop), [srandmember](https://redis.io/commands/srandmember), [srem](https://redis.io/commands/srem), [sscan](https://redis.io/commands/sscan), [strlen](https://redis.io/commands/strlen), [subscribe](https://redis.io/commands/subscribe), [substr](https://redis.io/commands/substr), [sunion](https://redis.io/commands/sunion), [sunionstore](https://redis.io/commands/sunionstore), [swapdb](https://redis.io/commands/swapdb), [sync](https://redis.io/commands/sync), [time](https://redis.io/commands/time), [touch](https://redis.io/commands/touch), [ttl](https://redis.io/commands/ttl), [type](https://redis.io/commands/type), [unlink](https://redis.io/commands/unlink), [unsubscribe](https://redis.io/commands/unsubscribe), [unwatch](https://redis.io/commands/unwatch), [wait](https://redis.io/commands/wait), [watch](https://redis.io/commands/watch), [zadd](https://redis.io/commands/zadd), [zcard](https://redis.io/commands/zcard), [zcount](https://redis.io/commands/zcount), [zincrby](https://redis.io/commands/zincrby), [zinterstore](https://redis.io/commands/zinterstore), [zlexcount](https://redis.io/commands/zlexcount), [zrange](https://redis.io/commands/zrange), [zrangebylex](https://redis.io/commands/zrangebylex), [zrangebyscore](https://redis.io/commands/zrangebyscore), [zrank](https://redis.io/commands/zrank), [zrem](https://redis.io/commands/zrem), [zremrangebylex](https://redis.io/commands/zremrangebylex), [zremrangebyrank](https://redis.io/commands/zremrangebyrank), [zremrangebyscore](https://redis.io/commands/zremrangebyscore), [zrevrange](https://redis.io/commands/zrevrange), [zrevrangebylex](https://redis.io/commands/zrevrangebylex), [zrevrangebyscore](https://redis.io/commands/zrevrangebyscore), [zrevrank](https://redis.io/commands/zrevrank), [zscan](https://redis.io/commands/zscan), [zscore](https://redis.io/commands/zscore), [zunionstore](https://redis.io/commands/zunionstore)
156157

157158
Example setting key to auto expire using [SET command](https://redis.io/commands/set)
158159

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"benchmark": "node benchmarks/multi_bench.js",
2323
"test": "nyc --cache mocha ./test/*.js ./test/commands/*.js --timeout=8000",
2424
"lint": "eslint . --fix && npm run coverage",
25-
"compare": "node benchmarks/diff_multi_bench_output.js beforeBench.txt afterBench.txt"
25+
"compare": "node benchmarks/diff_multi_bench_output.js beforeBench.txt afterBench.txt",
26+
"generate-cmds": "node tools/generate-commands"
2627
},
2728
"dependencies": {
2829
"double-ended-queue": "^2.1.0-0",

tools/generate-commands.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
var fs = require('fs');
4+
var commands = require('redis-commands');
5+
6+
var README_PATH = './README.md';
7+
var DOC_BEFORE = 'It is not a cache library so please refer to Redis commands page for full usage details:';
8+
var DOC_AFTER = 'Example setting key to auto expire';
9+
10+
// Create comma-separated list of links with commands:
11+
// [set](https://redis.io/commands/set), [xxx](https://redis.io.commands/xxx)
12+
var commandsList = commands.list
13+
.map(function (cmd) {
14+
return '[' + cmd + '](https://redis.io/commands/' + cmd + ')';
15+
})
16+
.join(', ');
17+
18+
// Replace old commands list in README and write to disk
19+
var readme = fs.readFileSync(README_PATH, 'utf8');
20+
var readmeBefore = readme.substr(0, readme.indexOf(DOC_BEFORE) + DOC_BEFORE.length);
21+
var readmeAfter = readme.substr(readme.indexOf(DOC_AFTER));
22+
fs.writeFileSync(README_PATH, readmeBefore + '\n\n' + commandsList + '\n\n' + readmeAfter, 'utf8');
23+
24+
console.log('Done!');

0 commit comments

Comments
 (0)