mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-11 22:13:20 +03:00
fix(skills): регистронезависимые параметры во всех py-портах
Дорожка CLI из кампании паритета: PowerShell не различает регистр ни в именах параметров, ни в значениях [ValidateSet], argparse различает и в том и в другом. Проверено на читающем навыке: cf-info -Mode BRIEF на PS отрабатывает, на py падал. ci_parse_args (эталон — meta-compile) вставлен в 68 py-портов, вызовы parser.parse_args заменены. Навыков с DSL меньше трети, поэтому именно эта правка делает паритет общим: *-info, *-validate, db-*, cfe-*, web-* тоже принимают ввод так же, как их .ps1. Реестр check-inline-drift дополнен списком потребителей — и сразу окупился: поймал, что массовая замена переписала последнюю строку внутри самого хелпера и копии стали рекурсивными. Версии бампнуты синхронно в обоих портах всех 68 навыков. Проверка: 673/673 (PS), 670+3 skipped (PY), гарды 4/4; паритет версий портов проверен по заголовкам. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
8c0fbed7d6
commit
d325a3d5af
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# db-load-git v1.18 — Load Git changes into 1C database
|
||||
# db-load-git v1.19 — Load Git changes into 1C database
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -14,6 +14,28 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# Регистронезависимый ввод — паритет с PS1: в PowerShell имена параметров и [ValidateSet]
|
||||
# регистр не различают, в argparse совпадение точное.
|
||||
def ci_parse_args(parser, argv=None):
|
||||
"""parse_args по правилам PS: имена параметров и значения choices регистронезависимы."""
|
||||
argv = list(sys.argv[1:] if argv is None else argv)
|
||||
names = {s.lower(): s for a in parser._actions for s in a.option_strings}
|
||||
for i, tok in enumerate(argv):
|
||||
if tok.startswith('-') and tok.lower() in names:
|
||||
argv[i] = names[tok.lower()]
|
||||
# choices — зеркало [ValidateSet]; канонизируем ДО разбора, иначе argparse отвергнет регистр
|
||||
choice_map = {}
|
||||
for a in parser._actions:
|
||||
if a.choices:
|
||||
for s in a.option_strings:
|
||||
choice_map[s] = {str(c).lower(): c for c in a.choices}
|
||||
for i in range(len(argv) - 1):
|
||||
m = choice_map.get(argv[i])
|
||||
if m and argv[i + 1].lower() in m:
|
||||
argv[i + 1] = m[argv[i + 1].lower()]
|
||||
return parser.parse_args(argv)
|
||||
|
||||
|
||||
|
||||
def _find_project_v8path():
|
||||
"""Walk up from CWD to find .v8-project.json and read its v8path."""
|
||||
@@ -430,7 +452,7 @@ def main():
|
||||
help="Extra ibcmd arguments in --key=value form")
|
||||
known_opts = {s.lower() for a in parser._actions for s in a.option_strings}
|
||||
argv, v8_extra, ibcmd_extra = extract_extra_args(sys.argv[1:], known_opts)
|
||||
args = parser.parse_args(argv)
|
||||
args = ci_parse_args(parser, argv)
|
||||
|
||||
args.V8Path = clean_path(args.V8Path, "-V8Path")
|
||||
args.InfoBasePath = clean_path(args.InfoBasePath, "-InfoBasePath")
|
||||
|
||||
Reference in New Issue
Block a user