mixlib-cli 2.0.3 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 130454764f2b0ccdeb5b1418e54096ca158d3abf3848d9f94ee8da72890c5bba
4
- data.tar.gz: 0e5b392d7cedc3c3531379f3fafa931c98a11ec74873e72d7808832020c7ed98
3
+ metadata.gz: 68387a8a44b1950e412ec9223768a222b4c1660aa020612acab1469d30ffb329
4
+ data.tar.gz: 5aca34f4245d223175b88531c14950652211defd8fbe39ebdbac73d79e33f59d
5
5
  SHA512:
6
- metadata.gz: 77131a784602b7034c9951e3af0ebb96682022e12b74c6633fc642c4b4da2674c4e141e5cebcc1b65bc32ff6b573e3bf0086e01082475cd5616b74a6b404efdc
7
- data.tar.gz: 62b29885776ccb91a9347d708ed6546c34614a784247f2b4b3ab83f850441f6d096813ff8ca764eb4764d22d2a1abfe602853940e8b72f863ca3a43dc98b2d50
6
+ metadata.gz: aaf246f2fbcadda3e6ad29cdd9b2e0b6bc5b68b4471dbad56828ef499f2cfbbee9c00ffe7ca9543ef7c38d8f260711766a759bd7117885f758edd387fa9fe8ef
7
+ data.tar.gz: 944784207d6b274ec01b87bec93c23a98cfd1357a6a3f5cdf2c38de6fb3e71caf8c7f9c020ad7fc5aa539c459622003529e8c964461ba11f12d35c07c5d07d8f
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
- # Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2008-2019 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -243,7 +243,7 @@ module Mixlib
243
243
  end
244
244
  if config[opt_key] && !opt_value[:in].include?(config[opt_key])
245
245
  reqarg = opt_value[:short] || opt_value[:long]
246
- puts "#{reqarg}: #{config[opt_key]} is not included in the list ['#{opt_value[:in].join("', '")}'] "
246
+ puts "#{reqarg}: #{config[opt_key]} is not one of the allowed values: #{friendly_opt_list(opt_value[:in])}"
247
247
  puts @opt_parser
248
248
  exit 2
249
249
  end
@@ -313,7 +313,7 @@ module Mixlib
313
313
  if opt_setting.key?(:description)
314
314
  description = opt_setting[:description].dup
315
315
  description << " (required)" if opt_setting[:required]
316
- description << " (included in ['#{opt_setting[:in].join("', '")}'])" if opt_setting[:in]
316
+ description << " (valid options: #{friendly_opt_list(opt_setting[:in])})" if opt_setting[:in]
317
317
  opt_setting[:description] = description
318
318
  arguments << description
319
319
  end
@@ -321,6 +321,16 @@ module Mixlib
321
321
  arguments
322
322
  end
323
323
 
324
+ # @private
325
+ # @param opt_arry [Array]
326
+ #
327
+ # @return [String] a friendly quoted list of items complete with "or"
328
+ def friendly_opt_list(opt_array)
329
+ opts = opt_array.map { |x| "'#{x}'" }
330
+ return opts.join(" or ") if opts.size < 3
331
+ opts[0..-2].join(", ") + ", or " + opts[-1]
332
+ end
333
+
324
334
  def self.included(receiver)
325
335
  receiver.extend(Mixlib::CLI::ClassMethods)
326
336
  receiver.extend(Mixlib::CLI::InheritMethods)
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  module CLI
3
- VERSION = "2.0.3".freeze
3
+ VERSION = "2.0.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-05-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple mixin for CLI interfaces, including option parsing
14
14
  email: info@chef.io
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  requirements: []
42
- rubygems_version: 3.0.1
42
+ rubygems_version: 3.0.3
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: A simple mixin for CLI interfaces, including option parsing