mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-19 17:19:42 +03:00
feat(meta-info): выводить «Представление типа» для ссылочных объектов
В шапке ссылочных объектов (справочники, документы, перечисления, ПВХ/ПВР, планы счетов, планы обмена, бизнес-процессы, задачи) теперь выводится строка «Представление типа» — имя ссылочного типа в диалогах выбора типа, с fallback ObjectPresentation -> Synonym -> Name. В режиме full дополнительно выводятся заданные сырые представления (объекта/списка и расширенные). Тесты: раннер принимает stdoutContains строкой или массивом, добавлен stdoutNotContains. Добавлены кейсы meta-info (ед.ч. ПВХ, full со всеми представлениями, fallback на синоним) и негативная проверка у регистра. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# meta-info v1.1 — Compact summary of 1C metadata object
|
||||
# meta-info v1.2 — Compact summary of 1C metadata object
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][Alias('Path')][string]$ObjectPath,
|
||||
@@ -422,6 +422,22 @@ $objName = $props.SelectSingleNode("md:Name", $ns).InnerText
|
||||
$synNode = $props.SelectSingleNode("md:Synonym", $ns)
|
||||
$synonym = Get-MLText $synNode
|
||||
|
||||
# Presentations (type-choice dialogs show "Представление объекта" as the ref type name)
|
||||
$objPresentation = Get-MLText $props.SelectSingleNode("md:ObjectPresentation", $ns)
|
||||
$extObjPresentation = Get-MLText $props.SelectSingleNode("md:ExtendedObjectPresentation", $ns)
|
||||
$listPresentation = Get-MLText $props.SelectSingleNode("md:ListPresentation", $ns)
|
||||
$extListPresentation = Get-MLText $props.SelectSingleNode("md:ExtendedListPresentation", $ns)
|
||||
|
||||
# Reference (ref-typed) metadata objects — those with a ...Ref type
|
||||
$refMdTypes = @("Catalog","Document","Enum","ChartOfAccounts","ChartOfCharacteristicTypes",
|
||||
"ChartOfCalculationTypes","ExchangePlan","BusinessProcess","Task")
|
||||
$isRefObject = $refMdTypes -contains $mdType
|
||||
|
||||
# Effective type presentation: ObjectPresentation -> Synonym -> Name
|
||||
$typePresentation = if ($objPresentation) { $objPresentation }
|
||||
elseif ($synonym) { $synonym }
|
||||
else { $objName }
|
||||
|
||||
# --- Handle -Name drill-down ---
|
||||
$drillDone = $false
|
||||
if ($Name -and $childObjs) {
|
||||
@@ -593,6 +609,17 @@ if (-not $drillDone) {
|
||||
$header += " ==="
|
||||
Out $header
|
||||
|
||||
# --- Type presentation (ref objects) ---
|
||||
if ($isRefObject) {
|
||||
Out "Представление типа: $typePresentation"
|
||||
if ($Mode -eq "full") {
|
||||
if ($objPresentation) { Out "Представление объекта: $objPresentation" }
|
||||
if ($extObjPresentation) { Out "Расширенное представление объекта: $extObjPresentation" }
|
||||
if ($listPresentation) { Out "Представление списка: $listPresentation" }
|
||||
if ($extListPresentation) { Out "Расширенное представление списка: $extListPresentation" }
|
||||
}
|
||||
}
|
||||
|
||||
# --- Mode: brief ---
|
||||
if ($Mode -eq "brief") {
|
||||
# Attributes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# meta-info v1.1 — Compact summary of 1C metadata object (Python port)
|
||||
# meta-info v1.2 — Compact summary of 1C metadata object (Python port)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import os
|
||||
@@ -477,6 +477,21 @@ obj_name = inner_text(find(props, "md:Name"))
|
||||
syn_node = find(props, "md:Synonym")
|
||||
synonym = get_ml_text(syn_node)
|
||||
|
||||
# Presentations (type-choice dialogs show "Представление объекта" as the ref type name)
|
||||
obj_presentation = get_ml_text(find(props, "md:ObjectPresentation"))
|
||||
ext_obj_presentation = get_ml_text(find(props, "md:ExtendedObjectPresentation"))
|
||||
list_presentation = get_ml_text(find(props, "md:ListPresentation"))
|
||||
ext_list_presentation = get_ml_text(find(props, "md:ExtendedListPresentation"))
|
||||
|
||||
# Reference (ref-typed) metadata objects — those with a ...Ref type
|
||||
ref_md_types = {"Catalog", "Document", "Enum", "ChartOfAccounts",
|
||||
"ChartOfCharacteristicTypes", "ChartOfCalculationTypes",
|
||||
"ExchangePlan", "BusinessProcess", "Task"}
|
||||
is_ref_object = md_type in ref_md_types
|
||||
|
||||
# Effective type presentation: ObjectPresentation -> Synonym -> Name
|
||||
type_presentation = obj_presentation or synonym or obj_name
|
||||
|
||||
# ── Handle -Name drill-down ──────────────────────────────────
|
||||
|
||||
drill_done = False
|
||||
@@ -636,6 +651,19 @@ if not drill_done:
|
||||
header += " ==="
|
||||
out(header)
|
||||
|
||||
# Type presentation (ref objects)
|
||||
if is_ref_object:
|
||||
out(f"Представление типа: {type_presentation}")
|
||||
if mode == "full":
|
||||
if obj_presentation:
|
||||
out(f"Представление объекта: {obj_presentation}")
|
||||
if ext_obj_presentation:
|
||||
out(f"Расширенное представление объекта: {ext_obj_presentation}")
|
||||
if list_presentation:
|
||||
out(f"Представление списка: {list_presentation}")
|
||||
if ext_list_presentation:
|
||||
out(f"Расширенное представление списка: {ext_list_presentation}")
|
||||
|
||||
if mode == "brief":
|
||||
# Attributes
|
||||
attrs = get_attributes(child_objs) if child_objs is not None else []
|
||||
|
||||
Reference in New Issue
Block a user