Skip to content

Commit

Permalink
Exclude current command from its own SEE ALSO section
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Söderqvist <[email protected]>
  • Loading branch information
zuiderkwast committed Sep 22, 2024
1 parent 00262ff commit b6382a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/preprocess-markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ def acl_categories(json):
acl.add("SLOW")
return ["@" + cat.lower() for cat in sorted(acl)]

def command_see_also(group, commands_per_group_file):
def command_see_also(group, commands_per_group_file, exclude_command):
"""Returns a dict {command: summary} of the commands in the given group"""
commands_per_group = loadjson(commands_per_group_file)
commands = commands_per_group.get(group)
if not commands:
return []
return {k: v.get("summary") for (k, v) in commands.items() if not v.get("deprecated")}
return {k: v.get("summary") for (k, v) in commands.items() if not v.get("deprecated") and k != exclude_command}

def rewrite_links(text, renderer):
def repl_link_match(match):
Expand Down Expand Up @@ -354,7 +354,7 @@ def main():
"history": command_metadata.get("history"),
"acl_categories": acl_categories(command_metadata),
"group": command_metadata.get("group"),
"see_also_commands": command_see_also(command_metadata.get("group"), args.commands_per_group_json)
"see_also_commands": command_see_also(command_metadata.get("group"), args.commands_per_group_json, name)
})
if "deprecated_since" in command_metadata:
data["deprecated_since"] = command_metadata["deprecated_since"]
Expand Down

0 comments on commit b6382a0

Please sign in to comment.