Skip to content

Commit 02bad72

Browse files
committed
Only per-branch settings are mutually exclusive
1 parent 225a3af commit 02bad72

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/octocatalog-diff/cli/options/hiera_path.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ def parse(parser, options)
2626
end,
2727
post_process: lambda do |opts|
2828
if opts.key?(:to_hiera_path_strip) && opts[:to_hiera_path_strip] != :none
29-
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
29+
if opts.key?(:to_hiera_path) && opts[:to_hiera_path] != :none
30+
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
31+
end
3032
end
3133
if opts.key?(:from_hiera_path_strip) && opts[:from_hiera_path_strip] != :none
32-
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
34+
if opts.key?(:from_hiera_path) && opts[:from_hiera_path] != :none
35+
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
36+
end
3337
end
3438
if opts[:to_hiera_path] == :none || opts[:from_hiera_path] == :none
3539
raise ArgumentError, '--hiera-path and --no-hiera-path are mutually exclusive'

lib/octocatalog-diff/cli/options/hiera_path_strip.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ def parse(parser, options)
1515
desc: 'Path prefix to strip when munging hiera.yaml',
1616
post_process: lambda do |opts|
1717
if opts.key?(:to_hiera_path) && opts[:to_hiera_path] != :none
18-
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
18+
if opts.key?(:to_hiera_path_strip) && opts[:to_hiera_path_strip] != :none
19+
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
20+
end
1921
end
2022
if opts.key?(:from_hiera_path) && opts[:from_hiera_path] != :none
21-
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
23+
if opts.key?(:from_hiera_path_strip) && opts[:from_hiera_path_strip] != :none
24+
raise ArgumentError, '--hiera-path and --hiera-path-strip are mutually exclusive'
25+
end
2226
end
2327
if opts[:to_hiera_path_strip] == :none || opts[:from_hiera_path_strip] == :none
2428
raise ArgumentError, '--hiera-path-strip and --no-hiera-path-strip are mutually exclusive'

0 commit comments

Comments
 (0)