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 +4 -4
- data/lib/mixlib/cli.rb +13 -3
- data/lib/mixlib/cli/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68387a8a44b1950e412ec9223768a222b4c1660aa020612acab1469d30ffb329
|
4
|
+
data.tar.gz: 5aca34f4245d223175b88531c14950652211defd8fbe39ebdbac73d79e33f59d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf246f2fbcadda3e6ad29cdd9b2e0b6bc5b68b4471dbad56828ef499f2cfbbee9c00ffe7ca9543ef7c38d8f260711766a759bd7117885f758edd387fa9fe8ef
|
7
|
+
data.tar.gz: 944784207d6b274ec01b87bec93c23a98cfd1357a6a3f5cdf2c38de6fb3e71caf8c7f9c020ad7fc5aa539c459622003529e8c964461ba11f12d35c07c5d07d8f
|
data/lib/mixlib/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2008-
|
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
|
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 << " (
|
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)
|
data/lib/mixlib/cli/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|