Skip to content

Commit

Permalink
Merge pull request #179 from zhuzhongshu123/0.6_dev_tc
Browse files Browse the repository at this point in the history
feat(bin): support multiple resigter names
  • Loading branch information
zhuzhongshu123 authored Dec 28, 2024
2 parents 192f213 + 058bb64 commit 023272d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions kag/bin/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,28 @@ def handle_cls(args: argparse.Namespace):
availables = cls_obj.list_available_with_detail()
seg = " " * 20

deduped_availables = {}
for register_name, cls_info in availables.items():
cls = cls_info["class"]
if cls not in deduped_availables:
deduped_availables[cls] = [register_name]
else:
deduped_availables[cls].append(register_name)

print(f"{bold}{red}{seg}Documentation of {args.cls}{seg}{reset}")
import inspect

print(inspect.getdoc(cls_obj))
print(f"{bold}{red}{seg}Registered subclasses of {args.cls}{seg}{reset}")
visited = set()
for register_name, cls_info in availables.items():
print(f"{bold}{blue}[{cls_info['class']}]{reset}")
print(f"{bold}{green}Register Name:{reset} {register_name}\n")
cls = cls_info["class"]
if cls in visited:
continue
visited.add(cls)
print(f"{bold}{blue}[{cls}]{reset}")
register_names = " / ".join([f'"{x}"' for x in deduped_availables[cls]])
print(f"{bold}{green}Register Name:{reset} {register_names}\n")

# print(f"Class Name: {cls_info['class']}")
print(f"{bold}{green}Documentation:{reset}\n{cls_info['doc']}\n")
Expand Down

0 comments on commit 023272d

Please sign in to comment.