ruby_cli 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +7 -2
- data/lib/ruby_cli.rb +3 -2
- metadata +6 -3
data/README.rdoc
CHANGED
@@ -39,7 +39,12 @@ This is the core algorithm of any Ruby CLI application
|
|
39
39
|
|
40
40
|
= Installation
|
41
41
|
|
42
|
-
|
42
|
+
Rubygems:
|
43
|
+
gem install ruby_cli
|
44
|
+
|
45
|
+
Not Rubygems:
|
46
|
+
1. use only files in lib folder
|
47
|
+
2. Use the RubyCLI module as a mixin for your CLI application
|
43
48
|
|
44
49
|
= Alternative Tools
|
45
50
|
|
@@ -71,7 +76,7 @@ applications.
|
|
71
76
|
|
72
77
|
= Usage Example 1
|
73
78
|
|
74
|
-
This example demonstrates how to use RubyCLI to create a
|
79
|
+
This example demonstrates how to use RubyCLI to create a command line application.
|
75
80
|
|
76
81
|
#!/usr/bin/ruby
|
77
82
|
|
data/lib/ruby_cli.rb
CHANGED
@@ -8,13 +8,14 @@ require 'optparse'
|
|
8
8
|
module RubyCLI
|
9
9
|
|
10
10
|
# Initialization of this application requires the command line arguments.
|
11
|
-
def initialize(default_argv, command_name)
|
11
|
+
def initialize(default_argv, command_name, usage = "[OPTIONS]... [ARGUMENTS]...")
|
12
12
|
@default_argv = default_argv
|
13
13
|
@default_options = {:help => false, :verbose => false}
|
14
14
|
define_command_options
|
15
15
|
define_command_arguments
|
16
16
|
@opt_parser = nil
|
17
17
|
@command_name = command_name
|
18
|
+
@usage = usage
|
18
19
|
end
|
19
20
|
|
20
21
|
# This method can be overwritten if you want to set defaults for your command
|
@@ -41,7 +42,7 @@ module RubyCLI
|
|
41
42
|
def define_option_parser
|
42
43
|
#configure an OptionParser
|
43
44
|
OptionParser.new do |opts|
|
44
|
-
opts.banner = "Usage: #{@command_name}
|
45
|
+
opts.banner = "Usage: #{@command_name} #{@usage}"
|
45
46
|
opts.separator ""
|
46
47
|
opts.separator "Specific options:"
|
47
48
|
opts.on('-h', '--help', 'displays help information') do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Martin Velez
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-09 00:00:00 -08:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -46,6 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
47
|
requirements:
|
47
48
|
- - ">="
|
48
49
|
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
49
51
|
segments:
|
50
52
|
- 0
|
51
53
|
version: "0"
|
@@ -54,6 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
56
|
requirements:
|
55
57
|
- - ">="
|
56
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
57
60
|
segments:
|
58
61
|
- 0
|
59
62
|
version: "0"
|