ruby_cli 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/examples/hello_world +0 -1
  2. data/lib/ruby_cli.rb +11 -7
  3. metadata +2 -2
data/examples/hello_world CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'rubygems'
4
3
  require 'ruby_cli'
5
4
 
6
5
  class App
data/lib/ruby_cli.rb CHANGED
@@ -36,12 +36,11 @@ module RubyCLI
36
36
  output_help(1)
37
37
  end
38
38
  end
39
-
40
- # Parse the options
41
- # Redefine this method if you want to add command specific options
42
- def parse_options?
39
+
40
+ # Redefine this method if you want to add command specific options
41
+ def define_option_parser
43
42
  #configure an OptionParser
44
- @opt_parser = OptionParser.new do |opts|
43
+ OptionParser.new do |opts|
45
44
  opts.banner = "Usage: #{@command_name} [OPTIONS]... [ARGUMENTS]..."
46
45
  opts.separator ""
47
46
  opts.separator "Specific options:"
@@ -52,8 +51,13 @@ module RubyCLI
52
51
  opts.on('-V','--verbose','Run verbosely') do
53
52
  @default_options[:verbose] = true
54
53
  end
55
- # If you redefine, you can add command specific options here!
54
+ # If you redefine, you can copy this method and add command specific options here!
56
55
  end
56
+ end
57
+
58
+ # Parse the options
59
+ def parse_options?
60
+ @opt_parser = define_option_parser
57
61
  @opt_parser.parse!(@default_argv) rescue return false
58
62
  return true
59
63
  end
@@ -81,7 +85,7 @@ module RubyCLI
81
85
  # Redefine if you need to process options.
82
86
  def process_options() return true end
83
87
 
84
- # Redefine if you need to process options.
88
+ # Redefine if you need to process arguments.
85
89
  def process_arguments() return true end
86
90
 
87
91
  # Application logic
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 4
9
- version: 0.0.4
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Martin Velez