gli 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/gli CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  # 1.9 adds realpath to resolve symlinks; 1.8 doesn't
3
3
  # have this method, so we add it so we get resolved symlinks
4
4
  # and compatibility
data/lib/gli.rb CHANGED
@@ -359,6 +359,13 @@ module GLI
359
359
  -1
360
360
  end
361
361
 
362
+ def flag_switch_index(args)
363
+ args.each_with_index do |item,index|
364
+ return index if item =~ /^[\-]/
365
+ end
366
+ -1
367
+ end
368
+
362
369
  def clear_nexts # :nodoc:
363
370
  @@next_desc = nil
364
371
  @@next_arg_name = nil
@@ -412,6 +419,15 @@ module GLI
412
419
  command,
413
420
  Hash.new,
414
421
  arguments)
422
+ elsif((index = flag_switch_index(args)) >= 0)
423
+ try_me = args[0..index-1]
424
+ rest = args[index..args.length]
425
+ new_args = rest + try_me
426
+ return parse_options_helper(new_args,
427
+ global_options,
428
+ command,
429
+ Hash.new,
430
+ arguments)
415
431
  else
416
432
  return global_options,command,command_options,arguments + args
417
433
  end
@@ -489,7 +505,6 @@ module GLI
489
505
  arguments)
490
506
  end
491
507
  end
492
-
493
508
  end
494
509
 
495
510
  def find_command(name) # :nodoc:
@@ -1,3 +1,3 @@
1
1
  module GLI
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
@@ -149,7 +149,7 @@ EOS
149
149
  if !dry_run
150
150
  File.open(bin_file,'w') do |file|
151
151
  file.chmod(0755)
152
- file.puts '#!/usr/bin/ruby'
152
+ file.puts '#!/usr/bin/env ruby'
153
153
  file.puts <<EOS
154
154
  # 1.9 adds realpath to resolve symlinks; 1.8 doesn't
155
155
  # have this method, so we add it so we get resolved symlinks
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 3
8
- - 0
9
- version: 1.3.0
8
+ - 1
9
+ version: 1.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Copeland
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-01 00:00:00 -04:00
17
+ date: 2011-06-26 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency