libis-tools 1.0.1 → 1.0.2
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.
- checksums.yaml +4 -4
- data/lib/libis/tools/cli/reorg.rb +35 -26
- data/lib/libis/tools/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: 5e609222120f658fb18e1594ed1f87f0c35bde28
|
4
|
+
data.tar.gz: 66d3563d04e59fd324a593754a74947b1c3a722f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef95ab98cc37ab82f24e92f1db943cd92eef3276964c5ee3c2591aa1575dda048bd01c2d6117a230726f6a7d735d1fca8d0591c0c256c206e868b57663782eec
|
7
|
+
data.tar.gz: ab8ffbcec667aa8f6d618f2f5c3cbc5295a46bea69038f7c3e4616e465c3f01044b2cc22bddf1963f3dac96695135b773048bb46d4eb41a3570654a405450b67
|
@@ -35,7 +35,8 @@ module Libis
|
|
35
35
|
overwrite: "Overwite target files if newer",
|
36
36
|
interactive: "Ask for action on changed files",
|
37
37
|
report: "Report file",
|
38
|
-
dummy: "Perform phantom actions (not affecting files)"
|
38
|
+
dummy: "Perform phantom actions (not affecting files)",
|
39
|
+
config: "Load saved configuration parameters"
|
39
40
|
}
|
40
41
|
|
41
42
|
REQ_HEADERS = {term: 'Term'}
|
@@ -43,6 +44,10 @@ module Libis
|
|
43
44
|
|
44
45
|
def self.included(klass)
|
45
46
|
klass.class_exec do
|
47
|
+
def klass.description(field)
|
48
|
+
"#{STRING_CONFIG[field]}." + (DEFAULT_CONFIG[field].nil? ? '' : " default: #{DEFAULT_CONFIG[field]}")
|
49
|
+
end
|
50
|
+
|
46
51
|
desc 'reorg [options]', 'Reorganize files'
|
47
52
|
long_desc <<-DESC
|
48
53
|
|
@@ -94,33 +99,36 @@ module Libis
|
|
94
99
|
before continuing of bailing out. If you are confident the settings are fine, you can skip this with the
|
95
100
|
'--unatttended' option. Handle with care!
|
96
101
|
|
102
|
+
Unless you have specified the '--unattended' options, you will be presented with a menu that allows you to
|
103
|
+
change the configuration parameters, run the tool with the current config or bail out.
|
104
|
+
|
97
105
|
DESC
|
98
106
|
|
99
|
-
method_option :base, aliases: '-b',
|
100
|
-
|
101
|
-
method_option :filter, aliases: '-f',
|
102
|
-
|
103
|
-
method_option :expression, aliases: '-e',
|
104
|
-
|
107
|
+
method_option :base, aliases: '-b',
|
108
|
+
desc: description(:base)
|
109
|
+
method_option :filter, aliases: '-f',
|
110
|
+
desc: description(:filter)
|
111
|
+
method_option :expression, aliases: '-e',
|
112
|
+
desc: description(:expression)
|
105
113
|
|
106
|
-
method_option :action, aliases: '-a',
|
107
|
-
|
108
|
-
method_option :overwrite, aliases: '-o',
|
109
|
-
|
110
|
-
method_option :interactive, aliases: '-i',
|
111
|
-
|
114
|
+
method_option :action, aliases: '-a', enum: VALID_ACTIONS.keys,
|
115
|
+
desc: description(:action)
|
116
|
+
method_option :overwrite, aliases: '-o', type: :boolean,
|
117
|
+
desc: description(:overwrite)
|
118
|
+
method_option :interactive, aliases: '-i', type: :boolean,
|
119
|
+
desc: description(:interactive)
|
112
120
|
|
113
|
-
method_option :report, aliases: '-r', banner: 'FILE',
|
114
|
-
|
121
|
+
method_option :report, aliases: '-r', banner: 'FILE',
|
122
|
+
desc: description(:report)
|
115
123
|
|
116
|
-
method_option :dummy,
|
117
|
-
|
124
|
+
method_option :dummy, aliases: '-d', type: :boolean,
|
125
|
+
desc: description(:dummy)
|
118
126
|
|
119
|
-
method_option :config, aliases: '-c',
|
120
|
-
|
127
|
+
method_option :config, aliases: '-c', type: :string,
|
128
|
+
desc: description(:config)
|
121
129
|
|
122
|
-
method_option :unattended, aliases: '-u',
|
123
|
-
|
130
|
+
method_option :unattended, aliases: '-u', type: :boolean,
|
131
|
+
desc: description(:unattended)
|
124
132
|
|
125
133
|
end
|
126
134
|
|
@@ -131,10 +139,11 @@ module Libis
|
|
131
139
|
|
132
140
|
# return config_write
|
133
141
|
|
134
|
-
DEFAULT_CONFIG.each {|key, value| config.set(key, value: value)
|
142
|
+
DEFAULT_CONFIG.each {|key, value| config.set(key, value: value) unless value.nil?}
|
135
143
|
config_read(options[:config]) if options[:config]
|
136
|
-
DEFAULT_CONFIG.each {|key, _| config.set(key, value: options[
|
137
|
-
run_menu
|
144
|
+
DEFAULT_CONFIG.each {|key, _| config.set(key, value: options[key]) if options.has_key?(key.to_s)}
|
145
|
+
run_menu unless options[:unattended]
|
146
|
+
do_reorg
|
138
147
|
end
|
139
148
|
|
140
149
|
protected
|
@@ -148,8 +157,8 @@ module Libis
|
|
148
157
|
value: -> {config_menu; 1}
|
149
158
|
}
|
150
159
|
|
151
|
-
choices << {name: "Run", value:
|
152
|
-
choices << {name: "Exit", value:
|
160
|
+
choices << {name: "Run", value: nil}
|
161
|
+
choices << {name: "Exit", value: -> {exit}}
|
153
162
|
|
154
163
|
selection = prompt.select "[ LIBIS Tool - ReOrg ]",
|
155
164
|
choices, cycle: true, default: 1
|
data/lib/libis/tools/version.rb
CHANGED