Skip to content

Commit 81c447a

Browse files
authored
SITE: test and fix command-related scripts (#2547)
1 parent bdf2eff commit 81c447a

File tree

515 files changed

+33
-798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

515 files changed

+33
-798
lines changed

build/add_cmds.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def generate_command_frontmatter(command_name: str, command_data: dict, all_comm
9292
'title': full_command_name,
9393
'linkTitle': full_command_name,
9494
'description': command_data.get('summary'),
95-
'syntax_str': str(c),
9695
'syntax_fmt': c.syntax(),
9796
'hidden': False # Default to not hidden
9897
})

build/update_cmds.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python3
22
import argparse
3+
import glob
34
import json
45
import logging
56
import os
6-
import glob
77

8-
from components.syntax import Command
98
from components.markdown import Markdown
9+
from components.syntax import Command
1010

1111

1212
def parse_args() -> argparse.Namespace:
@@ -21,6 +21,7 @@ def parse_args() -> argparse.Namespace:
2121
help='Directory to save railroad diagram SVG files')
2222
return parser.parse_args()
2323

24+
2425
def generate_railroad_diagrams(commands_data: dict, output_dir: str) -> None:
2526
"""Generate railroad diagrams for all commands."""
2627
try:
@@ -63,10 +64,35 @@ def generate_railroad_diagrams(commands_data: dict, output_dir: str) -> None:
6364
force=True # Force reconfiguration in case logging was already configured
6465
)
6566

66-
# Load all commands_*.json files
67+
# Load all commands_core.json and filter out stubbed commands
6768
all_commands = {}
68-
command_files = glob.glob('data/commands_*.json')
6969

70+
FILTER_PREFIXES = [
71+
"BF.",
72+
"CF.",
73+
"CMS.",
74+
"JSON.",
75+
"FT.",
76+
"_FT.",
77+
"SEARCH.",
78+
"TDIGEST.",
79+
"TIMESERIES.",
80+
"TOPK.",
81+
"TS.",
82+
]
83+
84+
logging.info("Loading commands from data/commands_core.json")
85+
with open('data/commands_core.json', 'r') as f:
86+
data = json.load(f)
87+
88+
filtered = {
89+
key: value
90+
for key, value in data.items()
91+
if not key.startswith(tuple(FILTER_PREFIXES))
92+
}
93+
all_commands.update(filtered)
94+
95+
command_files = glob.glob('data/commands_r*.json')
7096
for command_file in command_files:
7197
logging.info(f"Loading commands from {command_file}")
7298
with open(command_file, 'r') as f:
@@ -95,7 +121,6 @@ def generate_railroad_diagrams(commands_data: dict, output_dir: str) -> None:
95121
md.fm_data['railroad_diagram'] = railroad_file.replace('static/', '/')
96122

97123
md.fm_data.update({
98-
'syntax_str': str(c),
99124
'syntax_fmt': sf,
100125
})
101126
md.persist()

content/commands/acl-cat.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ railroad_diagram: /images/railroad/acl-cat.svg
3030
since: 6.0.0
3131
summary: Lists the ACL categories, or the commands inside a category.
3232
syntax_fmt: ACL CAT [category]
33-
syntax_str: ''
3433
title: ACL CAT
3534
---
3635
The command shows the available ACL categories if called without arguments.

content/commands/acl-deluser.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ railroad_diagram: /images/railroad/acl-deluser.svg
3636
since: 6.0.0
3737
summary: Deletes ACL users, and terminates their connections.
3838
syntax_fmt: ACL DELUSER username [username ...]
39-
syntax_str: ''
4039
title: ACL DELUSER
4140
---
4241
Delete all the specified ACL users and terminate all the connections that are

content/commands/acl-dryrun.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ railroad_diagram: /images/railroad/acl-dryrun.svg
4141
since: 7.0.0
4242
summary: Simulates the execution of a command by a user, without executing the command.
4343
syntax_fmt: ACL DRYRUN username command [arg [arg ...]]
44-
syntax_str: command [arg [arg ...]]
4544
title: ACL DRYRUN
4645
---
4746
Simulate the execution of a given command by a given user.

content/commands/acl-genpass.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ since: 6.0.0
3232
summary: Generates a pseudorandom, secure password that can be used to identify ACL
3333
users.
3434
syntax_fmt: ACL GENPASS [bits]
35-
syntax_str: ''
3635
title: ACL GENPASS
3736
---
3837
ACL users need a solid password in order to authenticate to the server without

content/commands/acl-getuser.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ railroad_diagram: /images/railroad/acl-getuser.svg
3939
since: 6.0.0
4040
summary: Lists the ACL rules of a user.
4141
syntax_fmt: ACL GETUSER username
42-
syntax_str: ''
4342
title: ACL GETUSER
4443
---
4544
The command returns all the rules defined for an existing ACL user.

content/commands/acl-help.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ railroad_diagram: /images/railroad/acl-help.svg
2424
since: 6.0.0
2525
summary: Returns helpful text about the different subcommands.
2626
syntax_fmt: ACL HELP
27-
syntax_str: ''
2827
title: ACL HELP
2928
---
3029
The `ACL HELP` command returns a helpful text describing the different subcommands.

content/commands/acl-list.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ railroad_diagram: /images/railroad/acl-list.svg
2828
since: 6.0.0
2929
summary: Dumps the effective rules in ACL file format.
3030
syntax_fmt: ACL LIST
31-
syntax_str: ''
3231
title: ACL LIST
3332
---
3433
The command shows the currently active ACL rules in the Redis server. Each

content/commands/acl-load.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ railroad_diagram: /images/railroad/acl-load.svg
2828
since: 6.0.0
2929
summary: Reloads the rules from the configured ACL file.
3030
syntax_fmt: ACL LOAD
31-
syntax_str: ''
3231
title: ACL LOAD
3332
---
3433
When Redis is configured to use an ACL file (with the `aclfile` configuration

0 commit comments

Comments
 (0)