feat: Redis command autocomplete in CLI
- New src/data/commands.ts: 139 Redis commands across 11 categories - CliView.vue: autocomplete dropdown with prefix matching - Category-colored command names (admin=read=green/write=yellow/etc) - Up/Down navigate suggestions, Tab/Enter selects, Escape closes - History navigation preserved when suggestions hidden - Syntax and description shown for each command
This commit is contained in:
+144
-10
@@ -1,7 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
// src/renderer/src/components/CliView.vue
|
||||
import { ref, nextTick, watch } from 'vue'
|
||||
import { ref, computed, nextTick, watch } from 'vue'
|
||||
import { useConnectionStore } from '@renderer/stores/connection'
|
||||
import { redisCommands } from '@renderer/data/commands'
|
||||
|
||||
const connStore = useConnectionStore()
|
||||
|
||||
@@ -9,6 +10,26 @@ const input = ref('')
|
||||
const history = ref<{ cmd: string; result: string; error?: boolean }[]>([])
|
||||
const historyIndex = ref(-1)
|
||||
const outputRef = ref<HTMLDivElement>()
|
||||
const suggestionIndex = ref(-1)
|
||||
|
||||
const showSuggestions = computed(() => {
|
||||
return suggestions.value.length > 0 && !input.value.includes(' ')
|
||||
})
|
||||
|
||||
const suggestions = computed(() => {
|
||||
const firstWord = input.value.split(/\s+/)[0]
|
||||
if (!firstWord) return []
|
||||
const prefix = firstWord.toUpperCase()
|
||||
return redisCommands
|
||||
.filter(cmd => cmd.name.startsWith(prefix))
|
||||
.slice(0, 8)
|
||||
})
|
||||
|
||||
function selectSuggestion(cmd: string) {
|
||||
input.value = cmd + ' '
|
||||
suggestionIndex.value = -1
|
||||
inputRef.value?.focus()
|
||||
}
|
||||
|
||||
async function execute() {
|
||||
if (!connStore.activeId || !input.value.trim()) return
|
||||
@@ -16,6 +37,7 @@ async function execute() {
|
||||
const cmd = input.value.trim()
|
||||
input.value = ''
|
||||
historyIndex.value = -1
|
||||
suggestionIndex.value = -1
|
||||
|
||||
const parts = cmd.split(/\s+/)
|
||||
const command = parts[0].toUpperCase()
|
||||
@@ -57,6 +79,30 @@ async function execute() {
|
||||
}
|
||||
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (showSuggestions.value) {
|
||||
if (e.key === 'ArrowDown') {
|
||||
e.preventDefault()
|
||||
suggestionIndex.value = Math.min(suggestionIndex.value + 1, suggestions.value.length - 1)
|
||||
return
|
||||
}
|
||||
if (e.key === 'ArrowUp') {
|
||||
e.preventDefault()
|
||||
suggestionIndex.value = Math.max(suggestionIndex.value - 1, -1)
|
||||
return
|
||||
}
|
||||
if (e.key === 'Enter' || e.key === 'Tab') {
|
||||
if (suggestionIndex.value >= 0 && suggestionIndex.value < suggestions.value.length) {
|
||||
e.preventDefault()
|
||||
selectSuggestion(suggestions.value[suggestionIndex.value].name)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (e.key === 'Escape') {
|
||||
suggestionIndex.value = -1
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault()
|
||||
execute()
|
||||
@@ -77,6 +123,19 @@ function onKeydown(e: KeyboardEvent) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const inputRef = ref<HTMLInputElement>()
|
||||
|
||||
function categoryColor(category: string): string {
|
||||
switch (category) {
|
||||
case 'admin': return 'var(--color-red)'
|
||||
case 'read': return 'var(--color-green)'
|
||||
case 'write': return 'var(--color-yellow)'
|
||||
case 'server': return 'var(--color-blue)'
|
||||
case 'pubsub': return 'var(--color-purple)'
|
||||
default: return 'var(--text-primary)'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -95,13 +154,30 @@ function onKeydown(e: KeyboardEvent) {
|
||||
</div>
|
||||
<div class="cli-input-bar">
|
||||
<span class="prompt">></span>
|
||||
<input
|
||||
v-model="input"
|
||||
class="cli-input"
|
||||
placeholder="Enter Redis command..."
|
||||
@keydown="onKeydown"
|
||||
autofocus
|
||||
/>
|
||||
<div class="cli-input-wrapper">
|
||||
<input
|
||||
ref="inputRef"
|
||||
v-model="input"
|
||||
class="cli-input"
|
||||
placeholder="Enter Redis command..."
|
||||
@keydown="onKeydown"
|
||||
autofocus
|
||||
/>
|
||||
<div v-if="showSuggestions" class="cli-suggestions">
|
||||
<div
|
||||
v-for="(cmd, index) in suggestions"
|
||||
:key="cmd.name"
|
||||
class="cli-suggestion-item"
|
||||
:class="{ active: index === suggestionIndex }"
|
||||
@click="selectSuggestion(cmd.name)"
|
||||
@mouseenter="suggestionIndex = index"
|
||||
>
|
||||
<span class="suggestion-name" :style="{ color: categoryColor(cmd.category) }">{{ cmd.name }}</span>
|
||||
<span class="suggestion-syntax">{{ cmd.syntax }}</span>
|
||||
<span class="suggestion-desc">{{ cmd.description }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -160,18 +236,76 @@ function onKeydown(e: KeyboardEvent) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.cli-input {
|
||||
.cli-input-wrapper {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.cli-input {
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: var(--text-primary);
|
||||
font-family: 'Cascadia Code', 'Fira Code', monospace;
|
||||
font-size: 13px;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.cli-input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.cli-suggestions {
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin-bottom: 4px;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 6px;
|
||||
max-height: 320px;
|
||||
overflow-y: auto;
|
||||
z-index: 100;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.cli-suggestion-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 6px 10px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.cli-suggestion-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.cli-suggestion-item.active,
|
||||
.cli-suggestion-item:hover {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.suggestion-name {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
font-family: 'Cascadia Code', 'Fira Code', monospace;
|
||||
}
|
||||
|
||||
.suggestion-syntax {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
font-family: 'Cascadia Code', 'Fira Code', monospace;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.suggestion-desc {
|
||||
font-size: 11px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
export type CommandCategory = 'admin' | 'read' | 'write' | 'pubsub' | 'server'
|
||||
|
||||
export interface RedisCommand {
|
||||
name: string
|
||||
syntax: string
|
||||
description: string
|
||||
category: CommandCategory
|
||||
}
|
||||
|
||||
export const redisCommands: RedisCommand[] = [
|
||||
// ─── String ───
|
||||
{ name: 'SET', syntax: 'SET key value [NX|XX] [GET] [EX seconds|PX milliseconds|EXAT timestamp|PXAT timestamp|KEEPTTL]', description: 'Set key to hold a string value', category: 'write' },
|
||||
{ name: 'GET', syntax: 'GET key', description: 'Get the value of a key', category: 'read' },
|
||||
{ name: 'SETEX', syntax: 'SETEX key seconds value', description: 'Set key with a timeout in seconds', category: 'write' },
|
||||
{ name: 'PSETEX', syntax: 'PSETEX key milliseconds value', description: 'Set key with a timeout in milliseconds', category: 'write' },
|
||||
{ name: 'SETNX', syntax: 'SETNX key value', description: 'Set key only if it does not exist', category: 'write' },
|
||||
{ name: 'MSET', syntax: 'MSET key value [key value ...]', description: 'Set multiple keys atomically', category: 'write' },
|
||||
{ name: 'MGET', syntax: 'MGET key [key ...]', description: 'Get the values of multiple keys', category: 'read' },
|
||||
{ name: 'INCR', syntax: 'INCR key', description: 'Increment integer value by 1', category: 'write' },
|
||||
{ name: 'DECR', syntax: 'DECR key', description: 'Decrement integer value by 1', category: 'write' },
|
||||
{ name: 'INCRBY', syntax: 'INCRBY key increment', description: 'Increment integer value by a number', category: 'write' },
|
||||
{ name: 'DECRBY', syntax: 'DECRBY key decrement', description: 'Decrement integer value by a number', category: 'write' },
|
||||
{ name: 'INCRBYFLOAT', syntax: 'INCRBYFLOAT key increment', description: 'Increment float value by a number', category: 'write' },
|
||||
{ name: 'APPEND', syntax: 'APPEND key value', description: 'Append a value to a key', category: 'write' },
|
||||
{ name: 'STRLEN', syntax: 'STRLEN key', description: 'Get the length of a string value', category: 'read' },
|
||||
{ name: 'GETRANGE', syntax: 'GETRANGE key start end', description: 'Get a substring of a string value', category: 'read' },
|
||||
{ name: 'SETRANGE', syntax: 'SETRANGE key offset value', description: 'Overwrite part of a string at an offset', category: 'write' },
|
||||
{ name: 'GETSET', syntax: 'GETSET key value', description: 'Set a key and return its old value', category: 'write' },
|
||||
{ name: 'GETDEL', syntax: 'GETDEL key', description: 'Get the value and delete the key', category: 'write' },
|
||||
// ─── Hash ───
|
||||
{ name: 'HSET', syntax: 'HSET key field value [field value ...]', description: 'Set hash fields', category: 'write' },
|
||||
{ name: 'HGET', syntax: 'HGET key field', description: 'Get a hash field value', category: 'read' },
|
||||
{ name: 'HMSET', syntax: 'HMSET key field value [field value ...]', description: 'Set multiple hash fields', category: 'write' },
|
||||
{ name: 'HMGET', syntax: 'HMGET key field [field ...]', description: 'Get multiple hash field values', category: 'read' },
|
||||
{ name: 'HGETALL', syntax: 'HGETALL key', description: 'Get all fields and values of a hash', category: 'read' },
|
||||
{ name: 'HDEL', syntax: 'HDEL key field [field ...]', description: 'Delete one or more hash fields', category: 'write' },
|
||||
{ name: 'HKEYS', syntax: 'HKEYS key', description: 'Get all field names in a hash', category: 'read' },
|
||||
{ name: 'HVALS', syntax: 'HVALS key', description: 'Get all values in a hash', category: 'read' },
|
||||
{ name: 'HLEN', syntax: 'HLEN key', description: 'Get the number of fields in a hash', category: 'read' },
|
||||
{ name: 'HEXISTS', syntax: 'HEXISTS key field', description: 'Check if a hash field exists', category: 'read' },
|
||||
{ name: 'HINCRBY', syntax: 'HINCRBY key field increment', description: 'Increment integer hash field', category: 'write' },
|
||||
{ name: 'HINCRBYFLOAT', syntax: 'HINCRBYFLOAT key field increment', description: 'Increment float hash field', category: 'write' },
|
||||
{ name: 'HSETNX', syntax: 'HSETNX key field value', description: 'Set hash field only if it does not exist', category: 'write' },
|
||||
{ name: 'HSCAN', syntax: 'HSCAN key cursor [MATCH pattern] [COUNT count]', description: 'Incrementally iterate hash fields', category: 'read' },
|
||||
{ name: 'HSTRLEN', syntax: 'HSTRLEN key field', description: 'Get the length of a hash field value', category: 'read' },
|
||||
// ─── List ───
|
||||
{ name: 'LPUSH', syntax: 'LPUSH key value [value ...]', description: 'Prepend values to a list', category: 'write' },
|
||||
{ name: 'RPUSH', syntax: 'RPUSH key value [value ...]', description: 'Append values to a list', category: 'write' },
|
||||
{ name: 'LRANGE', syntax: 'LRANGE key start stop', description: 'Get a range of list elements', category: 'read' },
|
||||
{ name: 'LLEN', syntax: 'LLEN key', description: 'Get the length of a list', category: 'read' },
|
||||
{ name: 'LPOP', syntax: 'LPOP key [count]', description: 'Remove and return the first element(s)', category: 'write' },
|
||||
{ name: 'RPOP', syntax: 'RPOP key [count]', description: 'Remove and return the last element(s)', category: 'write' },
|
||||
{ name: 'LSET', syntax: 'LSET key index value', description: 'Set a list element by index', category: 'write' },
|
||||
{ name: 'LREM', syntax: 'LREM key count value', description: 'Remove elements from a list', category: 'write' },
|
||||
{ name: 'LINDEX', syntax: 'LINDEX key index', description: 'Get a list element by index', category: 'read' },
|
||||
{ name: 'LINSERT', syntax: 'LINSERT key BEFORE|AFTER pivot value', description: 'Insert an element in a list', category: 'write' },
|
||||
{ name: 'LPOS', syntax: 'LPOS key value [RANK rank] [COUNT count] [MAXLEN len]', description: 'Find the index of a list element', category: 'read' },
|
||||
{ name: 'LTRIM', syntax: 'LTRIM key start stop', description: 'Trim a list to a specified range', category: 'write' },
|
||||
{ name: 'BLPOP', syntax: 'BLPOP key [key ...] timeout', description: 'Blocking LPOP with timeout', category: 'write' },
|
||||
{ name: 'BRPOP', syntax: 'BRPOP key [key ...] timeout', description: 'Blocking RPOP with timeout', category: 'write' },
|
||||
// ─── Set ───
|
||||
{ name: 'SADD', syntax: 'SADD key member [member ...]', description: 'Add members to a set', category: 'write' },
|
||||
{ name: 'SREM', syntax: 'SREM key member [member ...]', description: 'Remove members from a set', category: 'write' },
|
||||
{ name: 'SMEMBERS', syntax: 'SMEMBERS key', description: 'Get all members of a set', category: 'read' },
|
||||
{ name: 'SISMEMBER', syntax: 'SISMEMBER key member', description: 'Check if a member exists in a set', category: 'read' },
|
||||
{ name: 'SCARD', syntax: 'SCARD key', description: 'Get the number of members in a set', category: 'read' },
|
||||
{ name: 'SDIFF', syntax: 'SDIFF key [key ...]', description: 'Get the difference of multiple sets', category: 'read' },
|
||||
{ name: 'SINTER', syntax: 'SINTER key [key ...]', description: 'Get the intersection of multiple sets', category: 'read' },
|
||||
{ name: 'SUNION', syntax: 'SUNION key [key ...]', description: 'Get the union of multiple sets', category: 'read' },
|
||||
{ name: 'SPOP', syntax: 'SPOP key [count]', description: 'Remove and return random member(s)', category: 'write' },
|
||||
{ name: 'SRANDMEMBER', syntax: 'SRANDMEMBER key [count]', description: 'Get random member(s) without removal', category: 'read' },
|
||||
{ name: 'SMOVE', syntax: 'SMOVE source destination member', description: 'Move a member between sets', category: 'write' },
|
||||
{ name: 'SSCAN', syntax: 'SSCAN key cursor [MATCH pattern] [COUNT count]', description: 'Incrementally iterate set members', category: 'read' },
|
||||
// ─── Sorted Set ───
|
||||
{ name: 'ZADD', syntax: 'ZADD key [NX|XX] [GT|LT] [CH] [INCR] score member [score member ...]', description: 'Add members to a sorted set', category: 'write' },
|
||||
{ name: 'ZRANGE', syntax: 'ZRANGE key start stop [BYSCORE|BYLEX] [REV] [LIMIT offset count] [WITHSCORES]', description: 'Get a range of sorted set members', category: 'read' },
|
||||
{ name: 'ZRANGEBYSCORE', syntax: 'ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]', description: 'Get members by score range', category: 'read' },
|
||||
{ name: 'ZREM', syntax: 'ZREM key member [member ...]', description: 'Remove members from a sorted set', category: 'write' },
|
||||
{ name: 'ZSCORE', syntax: 'ZSCORE key member', description: 'Get the score of a member', category: 'read' },
|
||||
{ name: 'ZRANK', syntax: 'ZRANK key member', description: 'Get the rank of a member (low to high)', category: 'read' },
|
||||
{ name: 'ZREVRANK', syntax: 'ZREVRANK key member', description: 'Get the rank of a member (high to low)', category: 'read' },
|
||||
{ name: 'ZCARD', syntax: 'ZCARD key', description: 'Get the number of members in a sorted set', category: 'read' },
|
||||
{ name: 'ZCOUNT', syntax: 'ZCOUNT key min max', description: 'Count members with scores in a range', category: 'read' },
|
||||
{ name: 'ZINCRBY', syntax: 'ZINCRBY key increment member', description: 'Increment the score of a member', category: 'write' },
|
||||
{ name: 'ZPOPMAX', syntax: 'ZPOPMAX key [count]', description: 'Remove and return highest-scored members', category: 'write' },
|
||||
{ name: 'ZPOPMIN', syntax: 'ZPOPMIN key [count]', description: 'Remove and return lowest-scored members', category: 'write' },
|
||||
{ name: 'ZREMRANGEBYRANK', syntax: 'ZREMRANGEBYRANK key start stop', description: 'Remove members by rank range', category: 'write' },
|
||||
{ name: 'ZREMRANGEBYSCORE', syntax: 'ZREMRANGEBYSCORE key min max', description: 'Remove members by score range', category: 'write' },
|
||||
{ name: 'ZSCAN', syntax: 'ZSCAN key cursor [MATCH pattern] [COUNT count]', description: 'Incrementally iterate sorted set members', category: 'read' },
|
||||
// ─── Stream ───
|
||||
{ name: 'XADD', syntax: 'XADD key [NOMKSTREAM] [MAXLEN|MINID [=|~] threshold [LIMIT count]] *|id field value [field value ...]', description: 'Append a new entry to a stream', category: 'write' },
|
||||
{ name: 'XLEN', syntax: 'XLEN key', description: 'Get the length of a stream', category: 'read' },
|
||||
{ name: 'XRANGE', syntax: 'XRANGE key start end [COUNT count]', description: 'Get a range of stream entries', category: 'read' },
|
||||
{ name: 'XREVRANGE', syntax: 'XREVRANGE key end start [COUNT count]', description: 'Get a reversed range of stream entries', category: 'read' },
|
||||
{ name: 'XREAD', syntax: 'XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] id [id ...]', description: 'Read from one or more streams', category: 'read' },
|
||||
{ name: 'XDEL', syntax: 'XDEL key id [id ...]', description: 'Delete stream entries by ID', category: 'write' },
|
||||
{ name: 'XTRIM', syntax: 'XTRIM key MAXLEN|MINID [=|~] threshold [LIMIT count]', description: 'Trim a stream to a given length', category: 'write' },
|
||||
{ name: 'XINFO', syntax: 'XINFO [CONSUMERS key groupname|GROUPS key|STREAM key|HELP]', description: 'Get stream information', category: 'read' },
|
||||
{ name: 'XGROUP', syntax: 'XGROUP [CREATE key groupname id|$ [MKSTREAM]] [SETID key groupname id|$] [DESTROY key groupname] [CREATECONSUMER key groupname consumername] [DELCONSUMER key groupname consumername]', description: 'Manage consumer groups', category: 'write' },
|
||||
{ name: 'XREADGROUP', syntax: 'XREADGROUP GROUP group consumer [COUNT count] [BLOCK milliseconds] [NOACK] STREAMS key [key ...] id [id ...]', description: 'Read from a consumer group', category: 'read' },
|
||||
{ name: 'XACK', syntax: 'XACK key group id [id ...]', description: 'Acknowledge stream entries', category: 'write' },
|
||||
{ name: 'XPENDING', syntax: 'XPENDING key group [start end count] [consumer]', description: 'Get pending stream entries', category: 'read' },
|
||||
{ name: 'XCLAIM', syntax: 'XCLAIM key group consumer min-idle-time id [id ...] [IDLE ms] [TIME ms] [RETRYCOUNT count] [FORCE] [JUSTID]', description: 'Claim pending stream entries', category: 'write' },
|
||||
// ─── Key ───
|
||||
{ name: 'DEL', syntax: 'DEL key [key ...]', description: 'Delete one or more keys', category: 'write' },
|
||||
{ name: 'UNLINK', syntax: 'UNLINK key [key ...]', description: 'Non-blocking delete of keys', category: 'write' },
|
||||
{ name: 'EXISTS', syntax: 'EXISTS key [key ...]', description: 'Check if one or more keys exist', category: 'read' },
|
||||
{ name: 'EXPIRE', syntax: 'EXPIRE key seconds', description: 'Set a timeout in seconds on a key', category: 'write' },
|
||||
{ name: 'PEXPIRE', syntax: 'PEXPIRE key milliseconds', description: 'Set a timeout in milliseconds on a key', category: 'write' },
|
||||
{ name: 'TTL', syntax: 'TTL key', description: 'Get the remaining TTL in seconds', category: 'read' },
|
||||
{ name: 'PTTL', syntax: 'PTTL key', description: 'Get the remaining TTL in milliseconds', category: 'read' },
|
||||
{ name: 'PERSIST', syntax: 'PERSIST key', description: 'Remove the timeout from a key', category: 'write' },
|
||||
{ name: 'TYPE', syntax: 'TYPE key', description: 'Get the type of a key', category: 'read' },
|
||||
{ name: 'RENAME', syntax: 'RENAME key newkey', description: 'Rename a key', category: 'write' },
|
||||
{ name: 'RENAMENX', syntax: 'RENAMENX key newkey', description: 'Rename a key only if new key does not exist', category: 'write' },
|
||||
{ name: 'KEYS', syntax: 'KEYS pattern', description: 'Find all keys matching a pattern', category: 'read' },
|
||||
{ name: 'SCAN', syntax: 'SCAN cursor [MATCH pattern] [COUNT count] [TYPE type]', description: 'Incrementally iterate the keyspace', category: 'read' },
|
||||
{ name: 'RANDOMKEY', syntax: 'RANDOMKEY', description: 'Return a random key from the keyspace', category: 'read' },
|
||||
{ name: 'DUMP', syntax: 'DUMP key', description: 'Dump a serialized version of a key', category: 'read' },
|
||||
{ name: 'RESTORE', syntax: 'RESTORE key ttl serialized-value [REPLACE] [ABSTTL] [IDLETIME t] [FREQ f]', description: 'Restore a key from a serialized value', category: 'write' },
|
||||
{ name: 'COPY', syntax: 'COPY source destination [DB dest-db] [REPLACE]', description: 'Copy a key to another key', category: 'write' },
|
||||
{ name: 'OBJECT', syntax: 'OBJECT subcommand [arguments [arguments ...]]', description: 'Inspect the internals of Redis objects', category: 'read' },
|
||||
{ name: 'MEMORY', syntax: 'MEMORY subcommand [arguments [arguments ...]]', description: 'Memory usage and stats', category: 'read' },
|
||||
{ name: 'MOVE', syntax: 'MOVE key db', description: 'Move a key to another database', category: 'write' },
|
||||
// ─── Server ───
|
||||
{ name: 'INFO', syntax: 'INFO [section]', description: 'Get server information and statistics', category: 'server' },
|
||||
{ name: 'DBSIZE', syntax: 'DBSIZE', description: 'Return the number of keys in the database', category: 'server' },
|
||||
{ name: 'TIME', syntax: 'TIME', description: 'Return the current server time', category: 'server' },
|
||||
{ name: 'PING', syntax: 'PING [message]', description: 'Ping the server', category: 'server' },
|
||||
{ name: 'ECHO', syntax: 'ECHO message', description: 'Echo a message', category: 'server' },
|
||||
{ name: 'SELECT', syntax: 'SELECT index', description: 'Change the selected database', category: 'server' },
|
||||
// ─── Admin ───
|
||||
{ name: 'FLUSHDB', syntax: 'FLUSHDB [ASYNC|SYNC]', description: 'Remove all keys from the current database', category: 'admin' },
|
||||
{ name: 'FLUSHALL', syntax: 'FLUSHALL [ASYNC|SYNC]', description: 'Remove all keys from all databases', category: 'admin' },
|
||||
{ name: 'CONFIG', syntax: 'CONFIG subcommand [argument [argument ...]]', description: 'Configure Redis server', category: 'admin' },
|
||||
{ name: 'CLIENT', syntax: 'CLIENT subcommand [argument [argument ...]]', description: 'Manage client connections', category: 'admin' },
|
||||
{ name: 'SLOWLOG', syntax: 'SLOWLOG subcommand [argument]', description: 'Manage the slow log', category: 'admin' },
|
||||
{ name: 'BGSAVE', syntax: 'BGSAVE', description: 'Save the DB in background', category: 'admin' },
|
||||
{ name: 'BGREWRITEAOF', syntax: 'BGREWRITEAOF', description: 'Rewrite the append-only file', category: 'admin' },
|
||||
{ name: 'SAVE', syntax: 'SAVE', description: 'Save the DB synchronously', category: 'admin' },
|
||||
{ name: 'LASTSAVE', syntax: 'LASTSAVE', description: 'Get the timestamp of the last save', category: 'admin' },
|
||||
{ name: 'DEBUG', syntax: 'DEBUG subcommand [arguments [arguments ...]]', description: 'Debugging commands', category: 'admin' },
|
||||
{ name: 'SHUTDOWN', syntax: 'SHUTDOWN [NOSAVE|SAVE]', description: 'Shut down the server', category: 'admin' },
|
||||
{ name: 'MONITOR', syntax: 'MONITOR', description: 'Monitor all commands received by the server', category: 'admin' },
|
||||
{ name: 'AUTH', syntax: 'AUTH [username] password', description: 'Authenticate to the server', category: 'admin' },
|
||||
{ name: 'ACL', syntax: 'ACL subcommand [argument [argument ...]]', description: 'Manage Redis ACLs', category: 'admin' },
|
||||
{ name: 'CLUSTER', syntax: 'CLUSTER subcommand [argument [argument ...]]', description: 'Redis Cluster commands', category: 'admin' },
|
||||
// ─── PubSub ───
|
||||
{ name: 'PUBLISH', syntax: 'PUBLISH channel message', description: 'Post a message to a channel', category: 'pubsub' },
|
||||
{ name: 'SUBSCRIBE', syntax: 'SUBSCRIBE channel [channel ...]', description: 'Subscribe to channels', category: 'pubsub' },
|
||||
{ name: 'PSUBSCRIBE', syntax: 'PSUBSCRIBE pattern [pattern ...]', description: 'Subscribe to channel patterns', category: 'pubsub' },
|
||||
{ name: 'UNSUBSCRIBE', syntax: 'UNSUBSCRIBE [channel [channel ...]]', description: 'Unsubscribe from channels', category: 'pubsub' },
|
||||
{ name: 'PUNSUBSCRIBE', syntax: 'PUNSUBSCRIBE [pattern [pattern ...]]', description: 'Unsubscribe from channel patterns', category: 'pubsub' },
|
||||
{ name: 'PUBSUB', syntax: 'PUBSUB subcommand [argument [argument ...]]', description: 'PubSub inspection commands', category: 'pubsub' },
|
||||
// ─── Transaction ───
|
||||
{ name: 'MULTI', syntax: 'MULTI', description: 'Start a transaction block', category: 'write' },
|
||||
{ name: 'EXEC', syntax: 'EXEC', description: 'Execute all commands in a transaction', category: 'write' },
|
||||
{ name: 'DISCARD', syntax: 'DISCARD', description: 'Discard all commands in a transaction', category: 'write' },
|
||||
{ name: 'WATCH', syntax: 'WATCH key [key ...]', description: 'Watch keys for conditional execution', category: 'write' },
|
||||
{ name: 'UNWATCH', syntax: 'UNWATCH', description: 'Unwatch all keys', category: 'write' },
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user