mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-31 15:30:51 +03:00
fix(skills): «файл не найден» на входном JSON — одинаково во всех навыках
Часть навыков проверяла путь ко входному JSON сама и отвечала внятной строкой, часть — нет и роняла дамп: FileNotFoundError с traceback в py, MethodInvocationException с CategoryInfo в PS1. Один и тот же промах давал разный ответ в зависимости от навыка, а у form-edit — ещё и от порта. Проверка перенесена в тело семьи read_json_file / Read-JsonInputFile: пол одинаков везде по построению, и новые навыки получают его вместе с функцией. Навыки со своей проверкой срабатывают раньше и сохраняют прежний текст, поэтому существующие кейсы не двигаются. Заодно каталог вместо файла: раньше IsADirectoryError / отказ доступа, теперь «Expected a JSON file, got a directory». Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
229e66b907
commit
77ee8f1047
@@ -1,4 +1,4 @@
|
|||||||
# cf-edit v1.21 — Edit 1C configuration root (Configuration.xml)
|
# cf-edit v1.22 — Edit 1C configuration root (Configuration.xml)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)][Alias('Path')][string]$ConfigPath,
|
[Parameter(Mandatory)][Alias('Path')][string]$ConfigPath,
|
||||||
@@ -45,6 +45,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# cf-edit v1.21 — Edit 1C configuration root (Configuration.xml)
|
# cf-edit v1.22 — Edit 1C configuration root (Configuration.xml)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -52,7 +52,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# form-compile v1.194 — Compile 1C managed form from JSON or object metadata (гвард на группу additionalColumns без ключа columns)
|
# form-compile v1.195 — Compile 1C managed form from JSON or object metadata (гвард на группу additionalColumns без ключа columns)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$JsonPath,
|
[string]$JsonPath,
|
||||||
@@ -49,6 +49,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# form-compile v1.194 — Compile 1C managed form from JSON or object metadata (гвард на группу additionalColumns без ключа columns)
|
# form-compile v1.195 — Compile 1C managed form from JSON or object metadata (гвард на группу additionalColumns без ключа columns)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import copy
|
import copy
|
||||||
@@ -53,7 +53,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# form-edit v1.16 — Edit 1C managed form elements (+esc_xml/esc_xml_text: разное экранирование атрибута и текста)
|
# form-edit v1.17 — Edit 1C managed form elements (+esc_xml/esc_xml_text: разное экранирование атрибута и текста)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -45,6 +45,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# form-edit v1.16 — Edit 1C managed form elements (Python port) (+esc_xml/esc_xml_text: разное экранирование атрибута и текста)
|
# form-edit v1.17 — Edit 1C managed form elements (Python port) (+esc_xml/esc_xml_text: разное экранирование атрибута и текста)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -51,7 +51,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# interface-edit v1.20 — Edit 1C CommandInterface.xml (+русские алиасы типов: формы с ё и без)
|
# interface-edit v1.21 — Edit 1C CommandInterface.xml (+русские алиасы типов: формы с ё и без)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)][Alias('Path')][string]$CIPath,
|
[Parameter(Mandatory)][Alias('Path')][string]$CIPath,
|
||||||
@@ -51,6 +51,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# interface-edit v1.20 — Edit 1C CommandInterface.xml (+русские алиасы типов: формы с ё и без)
|
# interface-edit v1.21 — Edit 1C CommandInterface.xml (+русские алиасы типов: формы с ё и без)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -385,7 +385,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# meta-compile v1.97 — Compile 1C metadata object from JSON
|
# meta-compile v1.98 — Compile 1C metadata object from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -44,6 +44,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# meta-compile v1.97 — Compile 1C metadata object from JSON
|
# meta-compile v1.98 — Compile 1C metadata object from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -61,7 +61,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# meta-edit v1.40 — Edit existing 1C metadata object XML
|
# meta-edit v1.41 — Edit existing 1C metadata object XML
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -66,6 +66,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# meta-edit v1.40 — Edit existing 1C metadata object XML
|
# meta-edit v1.41 — Edit existing 1C metadata object XML
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -51,7 +51,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# mxl-compile v1.53 — Compile 1C spreadsheet from JSON
|
# mxl-compile v1.54 — Compile 1C spreadsheet from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -44,6 +44,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# mxl-compile v1.53 — Compile 1C spreadsheet from JSON
|
# mxl-compile v1.54 — Compile 1C spreadsheet from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import hashlib
|
import hashlib
|
||||||
@@ -51,7 +51,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# role-compile v1.30 — Compile 1C role from JSON
|
# role-compile v1.31 — Compile 1C role from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -44,6 +44,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# role-compile v1.30 — Compile 1C role from JSON
|
# role-compile v1.31 — Compile 1C role from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -51,7 +51,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# skd-compile v1.119 — Compile 1C DCS from JSON (+write_xml_file/write_utf8_bom: общий эталон записи)
|
# skd-compile v1.120 — Compile 1C DCS from JSON (+write_xml_file/write_utf8_bom: общий эталон записи)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -43,6 +43,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# skd-compile v1.119 — Compile 1C DCS from JSON (+write_xml_file/write_utf8_bom: общий эталон записи)
|
# skd-compile v1.120 — Compile 1C DCS from JSON (+write_xml_file/write_utf8_bom: общий эталон записи)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -50,7 +50,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# skd-decompile v0.94 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
# skd-decompile v0.95 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -44,6 +44,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# skd-decompile v0.94 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
# skd-decompile v0.95 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
@@ -47,7 +47,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# subsystem-compile v1.28 — Create 1C subsystem from JSON definition
|
# subsystem-compile v1.29 — Create 1C subsystem from JSON definition
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -44,6 +44,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# subsystem-compile v1.28 — Create 1C subsystem from JSON definition
|
# subsystem-compile v1.29 — Create 1C subsystem from JSON definition
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -51,7 +51,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# subsystem-edit v1.23 — Edit existing 1C subsystem XML (+тип Bot; cfe-diff/cfe-borrow: недостающие типы)
|
# subsystem-edit v1.24 — Edit existing 1C subsystem XML (+тип Bot; cfe-diff/cfe-borrow: недостающие типы)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)][Alias('Path')][string]$SubsystemPath,
|
[Parameter(Mandatory)][Alias('Path')][string]$SubsystemPath,
|
||||||
@@ -45,6 +45,17 @@ function ConvertFrom-JsonInput([string]$text, [string]$source, [string]$expected
|
|||||||
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
# разбирается успешно, и в конфигурацию уезжает имя из «замен». Кодовую страницу не подбираем:
|
||||||
# угаданное имя уйдёт в метаданные так же молча.
|
# угаданное имя уйдёт в метаданные так же молча.
|
||||||
function Read-JsonInputFile([string]$path) {
|
function Read-JsonInputFile([string]$path) {
|
||||||
|
# Проверка здесь, а не по навыкам: часть навыков проверяла путь сама, часть — нет, и один и тот
|
||||||
|
# же промах давал то внятную строку, то дамп MethodInvocationException. Навыки со своей
|
||||||
|
# проверкой срабатывают раньше и сохраняют свой текст.
|
||||||
|
if (-not (Test-Path -LiteralPath $path)) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] File not found: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (Test-Path -LiteralPath $path -PathType Container) {
|
||||||
|
[Console]::Error.WriteLine("[ERROR] Expected a JSON file, got a directory: $path")
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
if ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF) {
|
||||||
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
return [System.Text.Encoding]::UTF8.GetString($bytes, 3, $bytes.Length - 3)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# subsystem-edit v1.23 — Edit existing 1C subsystem XML (+тип Bot; cfe-diff/cfe-borrow: недостающие типы)
|
# subsystem-edit v1.24 — Edit existing 1C subsystem XML (+тип Bot; cfe-diff/cfe-borrow: недостающие типы)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -51,7 +51,14 @@ def read_json_file(path):
|
|||||||
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
BOM — объявление самого файла, поэтому ему верим; без BOM ждём строгий UTF-8. Кодовую
|
||||||
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
страницу не подбираем: угаданное имя уехало бы в метаданные молча.
|
||||||
"""
|
"""
|
||||||
|
import os as _pos
|
||||||
import sys as _psys
|
import sys as _psys
|
||||||
|
if not _pos.path.exists(path):
|
||||||
|
print("[ERROR] File not found: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
|
if _pos.path.isdir(path):
|
||||||
|
print("[ERROR] Expected a JSON file, got a directory: %s" % path, file=_psys.stderr)
|
||||||
|
_psys.exit(1)
|
||||||
with open(path, "rb") as _fh:
|
with open(path, "rb") as _fh:
|
||||||
data = _fh.read()
|
data = _fh.read()
|
||||||
if data[:3] == b"\xef\xbb\xbf":
|
if data[:3] == b"\xef\xbb\xbf":
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "Несуществующий файл определения: строка вместо дампа исключения",
|
||||||
|
"preRun": [
|
||||||
|
{
|
||||||
|
"script": "subsystem-compile/scripts/subsystem-compile",
|
||||||
|
"input": {
|
||||||
|
"name": "Продажи"
|
||||||
|
},
|
||||||
|
"args": {
|
||||||
|
"-DefinitionFile": "{inputFile}",
|
||||||
|
"-OutputDir": "{workDir}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"params": {
|
||||||
|
"ciPath": "Subsystems/Продажи/CommandInterface"
|
||||||
|
},
|
||||||
|
"inputFrom": "нет-такого-файла.json",
|
||||||
|
"expectError": "File not found:"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user