ultra_command_line 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7d5f1c9ad2b37af7304ad403376b35783b2a03
|
4
|
+
data.tar.gz: 2c61a52c160991594406998b87ffcee17f2e91e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf0b4710e322b50a51c40d9947096f2033c751979f9fb9b4eeb5fee7d467de09c83c6d4869598260fe79ea305378f529e6f579153cc1858132164f1619f6109d
|
7
|
+
data.tar.gz: 6abb1479caba4c7a0dffb158a0025fefa2fc5b42badb5ccd51f752697a83f361c1a460e0d065ec92123fc70925c9736c34942825d04261e5bf85dd429ff8312a
|
@@ -4,6 +4,7 @@ module UltraCommandLine
|
|
4
4
|
module Factory
|
5
5
|
|
6
6
|
DEFAULT_BANNER = ''.freeze
|
7
|
+
DEFAULT_COMMAND_TYPE = :bool
|
7
8
|
|
8
9
|
include UltraCommandLine::Utils::YamlFactory
|
9
10
|
|
@@ -12,17 +13,18 @@ module UltraCommandLine
|
|
12
13
|
options_definition_hash = definition_hash.fetch(:options, {})
|
13
14
|
manager = factory_options[:manager]
|
14
15
|
banner = definition_hash.fetch :banner, DEFAULT_BANNER
|
15
|
-
|
16
|
+
type = definition_hash.fetch :type, DEFAULT_COMMAND_TYPE
|
17
|
+
create_command name, type, options_definition_hash, banner, manager
|
16
18
|
end
|
17
19
|
|
18
20
|
private
|
19
21
|
|
20
|
-
def create_command(name, options_definition_hash, banner, manager)
|
22
|
+
def create_command(name, type, options_definition_hash, banner, manager)
|
21
23
|
options = options_definition_hash.map do |option_name, option_definition_hash|
|
22
24
|
option_type = option_definition_hash[:type].to_sym
|
23
25
|
UltraCommandLine::Commands::OptionDefinition.new option_name, option_type, option_definition_hash
|
24
26
|
end
|
25
|
-
new manager, name, banner, options: options
|
27
|
+
new manager, name, type, banner, options: options
|
26
28
|
end
|
27
29
|
|
28
30
|
end
|
@@ -19,11 +19,12 @@ module UltraCommandLine
|
|
19
19
|
include UltraCommandLine::Commands::CommandLineParser
|
20
20
|
|
21
21
|
|
22
|
-
attr_reader :name, :manager, :options, :aliases
|
22
|
+
attr_reader :name, :type, :manager, :options, :aliases
|
23
23
|
attr_accessor :banner
|
24
24
|
|
25
25
|
def initialize(manager,
|
26
26
|
name = '',
|
27
|
+
type = UltraCommandLine::Commands::Factory::DEFAULT_COMMAND_TYPE,
|
27
28
|
banner = UltraCommandLine::Commands::Factory::DEFAULT_BANNER,
|
28
29
|
options: [])
|
29
30
|
@manager = manager
|
@@ -34,6 +35,7 @@ module UltraCommandLine
|
|
34
35
|
self.banner = banner
|
35
36
|
@options = options
|
36
37
|
@aliases = [self.name]
|
38
|
+
@type = type
|
37
39
|
end
|
38
40
|
|
39
41
|
def root_command?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultra_command_line
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent B.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|