Browse code

Merged pull request #278 from totolici/redis-plugin.

Redis-cli plugin

Robby Russell authored on 26/04/2011 at 16:50:39
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,142 @@
0
+#compdef redis-cli rec
1
+#autoload
2
+
3
+#redis cli completion, based off homebrew completion (ref. 2011-04-14)
4
+
5
+local -a _1st_arguments
6
+_1st_arguments=(
7
+  'append:append a value to a key'
8
+  'auth:authenticate to the server'
9
+  'bgrewriteeaof:asynchronously rewrite the append-only file'
10
+  'bgsave:asynchornously save the dataset to disk'
11
+  'blpop:remove and get the first element in a list, or block until one is available'
12
+  'brpop:remove and get the last element in a list, or block until one is available'
13
+  'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available'
14
+  # 'config get:get the value of a configuration parameter'
15
+  # 'config set:set a configuration parameter to the given value'
16
+  # 'config resetstat: reset the stats returned by INFO'
17
+  'dbsize:return the number of keys in the selected database'
18
+  # 'debug object:get debugging information about a key'
19
+  # 'debug setgfault:make the server crash'
20
+  'decr:decrement the integer value of a key by one'
21
+  'decrby:decrement the integet value of a key by the given number'
22
+  'del:delete a key'
23
+  'discard:discard all commands issued after MULTI'
24
+  'echo:echo the given string'
25
+  'exec:execute all commands issued after a MULTI'
26
+  'exists:determine if a key exists'
27
+  'expire:set the time to live for a key, in seconds'
28
+  'expireat:set the expiration for a key as a UNIX timestamp'
29
+  'flushall:remove all keys from all databases'
30
+  'flushdb:remove all keys from the current database'
31
+  'get:get the value of a key'
32
+  'getbit:returns the bit value at offset in the string value stored at key'
33
+  'getrange:get a substring of the string stored at a key'
34
+  'getset:set the string value of a key and return its old value'
35
+  'hdel:delete a hash field'
36
+  'hexists:determine if a hash field exists'
37
+  'hget:get the value of a hash field'
38
+  'hgetall:get all the fields and values in a hash'
39
+  'hincrby:increment the integer value of a hash field by the given number'
40
+  'hkeys:get all the fields in a hash'
41
+  'hlen:get the number of fields in a hash'
42
+  'hmget:get the values of all the given hash fields'
43
+  'hmset:set multiple hash fields to multiple values'
44
+  'hset:set the string value of a hash field'
45
+  'hsetnx:set the value of a hash field, only if the field does not exist'
46
+  'hvals:get all the values in a hash'
47
+  'incr:increment the integer value of a key by one'
48
+  'incrby:increment the integer value of a key by the given number'
49
+  'info:get information and statistics about the server'
50
+  'keys:find all keys matching the given pattern'
51
+  'lastsave:get the UNIX timestamp of the last successful save to disk'
52
+  'lindex:get an element from a list by its index'
53
+  'linset:insert an element before or after another element in a list'
54
+  'llen:get the length of a list'
55
+  'lpop:remove and get the first element in a list'
56
+  'lpush:prepend a value to a list'
57
+  'lpushx:prepend a value to a list, only if the list exists'
58
+  'lrange:get a range of elements from a list'
59
+  'lrem:remove elements from a list'
60
+  'lset:set the value of an element in a list by its index'
61
+  'ltrim:trim a list to the specified range'
62
+  'mget:get the values of all the given keys'
63
+  'monitor:listen for all requests received by the server in real time'
64
+  'move:move a key to another database'
65
+  'mset:set multiple keys to muliple values'
66
+  'msetnx:set multiple keys tom ultiple values, only if none of the keys exist'
67
+  'multi:mark the start of a transaction block'
68
+  'object:inspect the internals of Redis objects'
69
+  'persist:remove the expiration from a key'
70
+  'ping:ping the server'
71
+  'psubscribe:listen for messages published to channels matching the given patterns'
72
+  'publish:post a message to a channel'
73
+  'punsubscribe:stop listening for messages posted to channels matching the given patterns'
74
+  'quit:close the connection'
75
+  'randomkey:return a random key from the keyspace'
76
+  'rename:rename a key'
77
+  'renamenx:rename a key, only if the new key does not exist'
78
+  'rpop:remove and get the last element in a list'
79
+  'rpoplpush:remove the last element in a list, append it to another list and return it'
80
+  'rpush:append a value to a list'
81
+  'rpushx:append a value to a list, only if the list exists'
82
+  'sadd:add a member to a set'
83
+  'save:synchronously save the dataset to disk'
84
+  'scard:get the number of members in a set'
85
+  'sdiff:subtract multiple sets'
86
+  'sdiffstore:subtract multiple sets and store the resulting set in a key'
87
+  'select:change the selected database for the current connection'
88
+  'set:set the string value of a key'
89
+  'setbit:sets or clears the bit at offset in the string value stored at key'
90
+  'setex:set the value and expiration of a key'
91
+  'setnx:set the value of a key, only if the key does not exist'
92
+  'setrange:overwrite part of a string at key starting at the specified offset'
93
+  'shutdown:synchronously save the dataset to disk and then shut down the server'
94
+  'sinter:intersect multiple sets'
95
+  'sinterstore:intersect multiple sets and store the resulting set in a key'
96
+  'sismember:determine if a given value is a member of a set'
97
+  'slaveof:make the server a slave of another instance, or promote it as master'
98
+  'smembers:get all the members in a set'
99
+  'smove:move a member from one set to another'
100
+  'sort:sort the elements in a list, set or sorted set'
101
+  'spop:remove and return a random member from a set'
102
+  'srandmember:get a random member from a set'
103
+  'srem:remove a member from a set'
104
+  'strlen:get the length of the value stored in a key'
105
+  'subscribe:listen for messages published to the given channels'
106
+  'sunion:add multiple sets'
107
+  'sunionstore:add multiple sets and store the resulting set in a key'
108
+  'ttl:get the time to live for a key'
109
+  'type:determine the type stored at key'
110
+  'unsubscribe:stop listening for messages posted to the given channels'
111
+  'unwatch:forget about all watched keys'
112
+  'watch:watch the given keys to determine execution of the MULTI/EXEC block'
113
+  'zadd:add a member to a sorted set, or update its score if it already exists'
114
+  'zcard:get the number of members in a sorted set'
115
+  'zcount:count the members in a sorted set with scores within the given values'
116
+  'zincrby:increment the score of a member in a sorted set'
117
+  'zinterstore:intersect multiple sorted sets and store the resulting sorted set in a new key'
118
+  'zrange:return a range of members in a sorted set, by index'
119
+  'zrangebyscore:return a range of members in a sorted set, by score'
120
+  'zrank:determine the index of a member in a sorted set'
121
+  'zrem:remove a member from a sorted set'
122
+  'zremrangebyrank:remove all members in a sorted set within the given indexes'
123
+  'zremrangebyscore:remove all members in a sorted set within the given scores'
124
+  'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low'
125
+  'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low'
126
+  'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low'
127
+  'zscore:get the score associated with the given member in a sorted set'
128
+  'zunionstore:add multiple sorted sets and store te resulting sorted set in a new key'
129
+)
130
+
131
+local expl
132
+
133
+_arguments \
134
+  '(-v --version)'{-v,--version}'[show version]' \
135
+  '(-h --help)'{-h,--help}'[show help]' \
136
+  '*:: :->subcmds' && return 0
137
+
138
+if (( CURRENT == 1 )); then
139
+  _describe -t commands "redis-cli subcommand" _1st_arguments
140
+  return
141
+fi
0 142
\ No newline at end of file
1 143
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+# add redis completion function to path
1
+fpath=($ZSH/plugins/redis-cli $fpath)
2
+autoload -U compinit
3
+compinit -i