From 6635be682fc2959592af7c9681fea02778d7f578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tina=20M=C3=BCller?= Date: Mon, 13 Jan 2025 01:02:24 +0100 Subject: [PATCH] Add --duplicate-keys flag to yamlpp-load* scripts --- bin/yamlpp-load | 3 +++ bin/yamlpp-load-dump | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bin/yamlpp-load b/bin/yamlpp-load index 5977dba0..0d76a21d 100755 --- a/bin/yamlpp-load +++ b/bin/yamlpp-load @@ -13,6 +13,7 @@ GetOptions( 'help|h' => \my $help, 'boolean=s' => \my $boolean, 'cyclic' => \my $cyclic, + 'duplicate-keys' => \my $duplicate_keys, 'merge' => \my $merge, 'perl' => \my $perl, 'module|M=s' => \my $module, @@ -70,6 +71,7 @@ sub _yamlpp { schema => \@schema, boolean => $boolean, cyclic_refs => $cyclic ? 'allow' : 'fatal', + duplicate_keys => $duplicate_keys ? 1 : 0, preserve => PRESERVE_ORDER, yaml_version => \@yaml_versions, ); @@ -133,6 +135,7 @@ Usage: Options: --boolean= 'perl', 'JSON::PP', 'boolean' --cyclic Allow cyclic references + --duplicate-keys Allow duplicate keys --merge Enable loading merge keys '<<' --perl Enable loading perl types and objects (use only on trusted input!) diff --git a/bin/yamlpp-load-dump b/bin/yamlpp-load-dump index e89eece9..c501d8b9 100755 --- a/bin/yamlpp-load-dump +++ b/bin/yamlpp-load-dump @@ -15,6 +15,7 @@ GetOptions( 'help|h' => \my $help, 'boolean=s' => \my $boolean, 'cyclic' => \my $cyclic, + 'duplicate-keys' => \my $duplicate_keys, 'indent=i' => \my $indent, 'width=i' => \my $width, 'header!' => \my $header, @@ -131,6 +132,7 @@ sub _yamlpp { schema => \@schema, boolean => $boolean, cyclic_refs => $cyclic ? 'allow' : 'fatal', + duplicate_keys => $duplicate_keys ? 1 : 0, preserve => $preserve, indent => $indent, width => $width, @@ -279,6 +281,7 @@ Usage: Options: --boolean= 'perl', 'JSON::PP', 'boolean' --cyclic Allow cyclic references + --duplicate-keys Allow duplicate keys --indent= Number of spaces for indentation --width= Maximum column width (only used in flow style for now) --[no-]header Print '---' (default)