Skip to content

Commit

Permalink
Add --duplicate-keys option to yamlpp-load* scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
perlpunk committed Jan 13, 2025
1 parent b14ead5 commit ab76146
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion bin/yamlpp-load
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GetOptions(
'help|h' => \my $help,
'boolean=s' => \my $boolean,
'cyclic' => \my $cyclic,
'duplicate-keys=i' => \my $duplicate_keys,
'merge' => \my $merge,
'perl' => \my $perl,
'module|M=s' => \my $module,
Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -132,7 +134,8 @@ Usage:
Options:
--boolean= 'perl', 'JSON::PP', 'boolean'
--cyclic Allow cyclic references
--cyclic Set to 1 to allow cyclic references
--duplicate-keys= Set to 1 to allow duplicate keys
--merge Enable loading merge keys '<<'
--perl Enable loading perl types and objects (use only
on trusted input!)
Expand Down
5 changes: 4 additions & 1 deletion bin/yamlpp-load-dump
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GetOptions(
'help|h' => \my $help,
'boolean=s' => \my $boolean,
'cyclic' => \my $cyclic,
'duplicate-keys=i' => \my $duplicate_keys,
'indent=i' => \my $indent,
'width=i' => \my $width,
'header!' => \my $header,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -278,7 +280,8 @@ Usage:
Options:
--boolean= 'perl', 'JSON::PP', 'boolean'
--cyclic Allow cyclic references
--cyclic Set to 1 to allow cyclic references
--duplicate-keys= Set to 1 to allow duplicate keys
--indent= Number of spaces for indentation
--width= Maximum column width (only used in flow style for now)
--[no-]header Print '---' (default)
Expand Down

0 comments on commit ab76146

Please sign in to comment.