j
This commit is contained in:
@@ -147,6 +147,14 @@ def get_cmdlet_metadata(
|
||||
details = getattr(data, "detail", base.get("detail", [])) or []
|
||||
args_list = getattr(data, "arg", base.get("arg", [])) or []
|
||||
args = [_normalize_arg(arg) for arg in args_list]
|
||||
examples_list = getattr(data, "examples", base.get("examples", [])) or []
|
||||
if not examples_list:
|
||||
examples_list = getattr(data, "example", base.get("example", [])) or []
|
||||
examples = []
|
||||
for example in examples_list:
|
||||
text = str(example or "").strip()
|
||||
if text:
|
||||
examples.append(text)
|
||||
|
||||
if _should_hide_db_args(config):
|
||||
args = [a for a in args if not a.get("requires_db")]
|
||||
@@ -158,6 +166,7 @@ def get_cmdlet_metadata(
|
||||
"summary": summary,
|
||||
"details": details,
|
||||
"args": args,
|
||||
"examples": examples,
|
||||
"raw": data,
|
||||
}
|
||||
|
||||
@@ -183,6 +192,7 @@ def list_cmdlet_metadata(config: Optional[Dict[str, Any]] = None) -> Dict[str, D
|
||||
"summary": "",
|
||||
"details": [],
|
||||
"args": [],
|
||||
"examples": meta.get("examples", []),
|
||||
"raw": meta.get("raw"),
|
||||
},
|
||||
)
|
||||
@@ -198,6 +208,15 @@ def list_cmdlet_metadata(config: Optional[Dict[str, Any]] = None) -> Dict[str, D
|
||||
base["details"] = meta["details"]
|
||||
if not base.get("args") and meta.get("args"):
|
||||
base["args"] = meta["args"]
|
||||
example_sources: List[str] = []
|
||||
for attr in ("examples", "example"):
|
||||
values = meta.get(attr, []) if isinstance(meta, dict) else []
|
||||
example_sources.extend(values or [])
|
||||
merged_examples = [e for e in base.get("examples", []) or []]
|
||||
for example_entry in example_sources:
|
||||
if example_entry not in merged_examples:
|
||||
merged_examples.append(example_entry)
|
||||
base["examples"] = merged_examples
|
||||
if not base.get("raw"):
|
||||
base["raw"] = meta.get("raw")
|
||||
entries[canonical] = base
|
||||
@@ -211,6 +230,7 @@ def list_cmdlet_metadata(config: Optional[Dict[str, Any]] = None) -> Dict[str, D
|
||||
"summary": "",
|
||||
"details": [],
|
||||
"args": [],
|
||||
"examples": [],
|
||||
"raw": None,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user