mixlib-cli 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,4 +72,8 @@ Available arguments to 'option':
72
72
  :exit:: Exit your program with the exit code when this option is specified. Example: 0
73
73
  :proc:: If set, the configuration value will be set to the return value of this proc.
74
74
 
75
+ === New in 1.2.0
76
+
77
+ We no longer destructively manipulate ARGV.
78
+
75
79
  Have fun!
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
- :minor: 1
3
+ :minor: 2
4
4
  :patch: 0
@@ -118,6 +118,7 @@ module Mixlib
118
118
  # === Returns
119
119
  # argv<Array>:: Returns any un-parsed elements.
120
120
  def parse_options(argv=ARGV)
121
+ argv = argv.dup
121
122
  @opt_parser = OptionParser.new do |opts|
122
123
  # Set the banner
123
124
  opts.banner = banner
@@ -168,6 +168,21 @@ describe Mixlib::CLI do
168
168
  lambda { @cli.parse_options([]) }.should raise_error(SystemExit)
169
169
  end
170
170
 
171
+ it "should preserve all of the commandline arguments, ARGV" do
172
+ TestCLI.option(:config_file, :short => "-c CONFIG")
173
+ @cli = TestCLI.new
174
+ argv_old = ARGV.dup
175
+ ARGV.replace ['-c','foo.rb']
176
+ @cli.parse_options()
177
+ ARGV.should == ['-c','foo.rb']
178
+ ARGV.replace argv_old
179
+ end
180
+
181
+ it "should return any un-parsed elements" do
182
+ TestCLI.option(:party, :short => "-p LOCATION")
183
+ @cli = TestCLI.new
184
+ @cli.parse_options([ '-p', 'opscode', 'hard' ]).should == ['hard']
185
+ end
171
186
  end
172
187
  end
173
188
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 1.1.0
9
+ version: 1.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Opscode, Inc.
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-28 00:00:00 -08:00
17
+ date: 2010-03-31 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20