everyday_thor_util 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/everyday_thor_util/plugin-helper.rb +16 -0
- data/lib/everyday_thor_util/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bf4760adf8ab8b33555fc1c41ab010b4d27ebe
|
4
|
+
data.tar.gz: 74835c528cf90a6fc72ca97ff85674f448479aa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc3a29eb9228242f32030ac2e26eca9dfef7e9a8bc167a170f9a0b9a95acb8270664c8d99788b6651c3a8fac8c4d5f455c45aee1ed74926cb1cb29c880afa563
|
7
|
+
data.tar.gz: 64f974643eda5c09eb63b379c0f814d909c441d30001cfa875b1b89b514da672ed0a778386e70bd3872012007479421f6f2c8301e7e726999a9dca5ee4b5ea34
|
@@ -18,6 +18,7 @@ end
|
|
18
18
|
module EverydayThorUtil
|
19
19
|
class SubCommandTypes
|
20
20
|
extend PluginType
|
21
|
+
extend Plugin
|
21
22
|
extend TypeHelper
|
22
23
|
|
23
24
|
class << self
|
@@ -103,6 +104,21 @@ module EverydayThorUtil
|
|
103
104
|
}
|
104
105
|
end
|
105
106
|
end
|
107
|
+
|
108
|
+
def def_helper(helper_symbol, which_helper, method_name = nil, global = true, parent = nil)
|
109
|
+
case(which_helper)
|
110
|
+
when :print_info
|
111
|
+
register(helper_symbol, name: (method_name || 'print_info'), global: global, parent: parent) { |meth, &eval_block|
|
112
|
+
meth_obj = self.method(meth)
|
113
|
+
puts "command: #{meth.to_s}"
|
114
|
+
puts "parent_options: #{parent_options.inspect}"
|
115
|
+
puts "options: #{options.inspect}"
|
116
|
+
meth_obj.parameters.each { |p| puts "#{p[1].to_s}: #{eval_block.call(p[1].to_s)}" } if eval_block
|
117
|
+
}
|
118
|
+
else
|
119
|
+
puts "Unknown helper #{which_helper}"
|
120
|
+
end
|
121
|
+
end
|
106
122
|
end
|
107
123
|
end
|
108
124
|
end
|