ruby_cli 0.0.2 → 0.0.3

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.
Files changed (3) hide show
  1. data/bin/hello_world +2 -1
  2. data/lib/ruby_cli.rb +3 -2
  3. metadata +3 -3
data/bin/hello_world CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
+ require 'rubygems'
3
4
  require 'ruby_cli'
4
5
 
5
6
  class App
@@ -12,6 +13,6 @@ class App
12
13
  end
13
14
 
14
15
  if __FILE__ == $0
15
- app = App.new(ARGV)
16
+ app = App.new(ARGV, __FILE__)
16
17
  app.run
17
18
  end
data/lib/ruby_cli.rb CHANGED
@@ -33,12 +33,13 @@ require 'optparse'
33
33
  module RubyCLI
34
34
 
35
35
  # Initialization of this application requires the command line arguments.
36
- def initialize(default_argv)
36
+ def initialize(default_argv, command_name)
37
37
  @default_argv = default_argv
38
38
  @default_options = {:help => false, :verbose => false}
39
39
  define_command_options
40
40
  define_command_arguments
41
41
  @opt_parser = nil
42
+ @command_name = command_name
42
43
  end
43
44
 
44
45
  # This method can be overwritten if you want to set defaults for your command
@@ -67,7 +68,7 @@ module RubyCLI
67
68
  def parse_options?
68
69
  #configure an OptionParser
69
70
  @opt_parser = OptionParser.new do |opts|
70
- opts.banner = "Usage: #{__FILE__} [OPTIONS]... [ARGUMENTS]..."
71
+ opts.banner = "Usage: #{@command_name} [OPTIONS]... [ARGUMENTS]..."
71
72
  opts.separator ""
72
73
  opts.separator "Specific options:"
73
74
  opts.on('-h', '--help', 'displays help information') do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_cli
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Martin Velez