docs: concise explanation for check-yaml allow duplicate key feature.

This commit is contained in:
Frerk Saxen 2023-07-18 12:59:49 +02:00
parent aaa58f760c
commit d788663a74
4 changed files with 11 additions and 10 deletions

View file

@ -54,18 +54,19 @@ def main(argv: Sequence[str] | None = None) -> int:
)
parser.add_argument('filenames', nargs='*', help='Filenames to check.')
parser.add_argument(
'--allow_duplicate_keys', '--allow-duplicate-keys', action='store_true',
help=('In JSON mapping keys should be unique, in YAML they must be unique.'
'PyYAML never enforced this although the YAML 1.1 specification already required this.'
'Duplicate keys in mappings are no longer allowed by default.'
'Use this parameter to allow duplicate keys in yaml files.'
'--allow_duplicate_keys', '--allow-duplicate-keys',
action='store_true',
help=(
'Use this parameter to allow duplicate keys in yaml files.'
'Duplicate keys in yaml files are not allowed by default.'
'However, e.g. gitlab-ci.yml files may require this.'
),
)
args = parser.parse_args(argv)
yaml.allow_duplicate_keys = args.allow_duplicate_keys
load_fn = LOAD_FNS[Key(multi=args.multi, unsafe=args.unsafe)]
retval = 0