markdown_exec 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek +3 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +32 -9
- data/Gemfile +5 -0
- data/Gemfile.lock +15 -13
- data/README.md +56 -0
- data/Rakefile +182 -63
- data/bin/tab_completion.sh +21 -3
- data/bin/tab_completion.sh.erb +23 -0
- data/lib/cli.rb +19 -0
- data/lib/environment_opt_parse.rb +200 -0
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +222 -139
- data/lib/menu.yml +135 -64
- data/lib/object_present.rb +40 -0
- data/lib/shared.rb +3 -14
- data/lib/tap.rb +76 -21
- metadata +5 -2
data/Rakefile
CHANGED
@@ -3,8 +3,17 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rake/testtask'
|
5
5
|
require 'erb'
|
6
|
+
# require 'rspec'
|
7
|
+
require 'rubocop'
|
6
8
|
require 'yaml'
|
7
9
|
|
10
|
+
# begin
|
11
|
+
# require 'rspec/core/rake_task'
|
12
|
+
# RSpec::Core::RakeTask.new(:spec)
|
13
|
+
# rescue LoadError
|
14
|
+
# puts 'RSpec is required to run some tests.'
|
15
|
+
# end
|
16
|
+
|
8
17
|
Rake::TestTask.new(:test) do |task|
|
9
18
|
task.libs << 'test'
|
10
19
|
task.libs << 'lib'
|
@@ -13,10 +22,13 @@ end
|
|
13
22
|
|
14
23
|
require 'rubocop/rake_task'
|
15
24
|
|
25
|
+
require_relative 'lib/cli'
|
16
26
|
require_relative 'lib/markdown_exec/version'
|
17
27
|
require_relative 'lib/shared'
|
18
28
|
require_relative 'lib/tap'
|
19
29
|
|
30
|
+
include CLI
|
31
|
+
|
20
32
|
include Tap
|
21
33
|
tap_config envvar: MarkdownExec::TAP_DEBUG
|
22
34
|
|
@@ -30,6 +42,7 @@ task :rubocopminitest do
|
|
30
42
|
end
|
31
43
|
|
32
44
|
task default: %i[test reek rubocop rubocopminitest]
|
45
|
+
# task default: %i[spec test reek rubocop rubocopminitest]
|
33
46
|
|
34
47
|
# task :default => :build
|
35
48
|
|
@@ -83,14 +96,14 @@ task :update_menu_yml do
|
|
83
96
|
long_name: 'block-name',
|
84
97
|
opt_name: 'block_name',
|
85
98
|
short_name: 'b',
|
86
|
-
|
99
|
+
procname: 'val_as_str'
|
87
100
|
},
|
88
101
|
{
|
89
102
|
arg_name: 'PATH',
|
90
103
|
default: '.',
|
91
104
|
description: 'Read configuration file',
|
92
105
|
long_name: 'config',
|
93
|
-
|
106
|
+
procname: 'path'
|
94
107
|
},
|
95
108
|
{
|
96
109
|
arg_name: 'BOOL',
|
@@ -99,7 +112,7 @@ task :update_menu_yml do
|
|
99
112
|
env_var: MarkdownExec::TAP_DEBUG,
|
100
113
|
long_name: 'debug',
|
101
114
|
short_name: 'd',
|
102
|
-
|
115
|
+
procname: 'debug'
|
103
116
|
},
|
104
117
|
{
|
105
118
|
arg_name: 'RELATIVE_PATH',
|
@@ -109,13 +122,13 @@ task :update_menu_yml do
|
|
109
122
|
long_name: 'filename',
|
110
123
|
opt_name: 'filename',
|
111
124
|
short_name: 'f',
|
112
|
-
|
125
|
+
procname: 'val_as_str'
|
113
126
|
},
|
114
127
|
{
|
115
128
|
description: 'App help',
|
116
129
|
long_name: 'help',
|
117
130
|
short_name: 'h',
|
118
|
-
|
131
|
+
procname: 'help'
|
119
132
|
},
|
120
133
|
{
|
121
134
|
arg_name: 'RELATIVE_PATH',
|
@@ -125,7 +138,7 @@ task :update_menu_yml do
|
|
125
138
|
long_name: 'path',
|
126
139
|
opt_name: 'path',
|
127
140
|
short_name: 'p',
|
128
|
-
|
141
|
+
procname: 'val_as_str'
|
129
142
|
},
|
130
143
|
{
|
131
144
|
arg_name: 'BOOL',
|
@@ -135,24 +148,24 @@ task :update_menu_yml do
|
|
135
148
|
long_name: 'user-must-approve',
|
136
149
|
opt_name: 'user_must_approve',
|
137
150
|
short_name: 'q',
|
138
|
-
|
151
|
+
procname: 'val_as_bool'
|
139
152
|
},
|
140
153
|
{
|
141
154
|
description: "Print the gem's version",
|
142
155
|
long_name: 'version',
|
143
156
|
short_name: 'v',
|
144
|
-
|
157
|
+
procname: 'version'
|
145
158
|
},
|
146
159
|
{
|
147
160
|
description: 'Exit app',
|
148
161
|
long_name: 'exit',
|
149
162
|
short_name: 'x',
|
150
|
-
|
163
|
+
procname: 'exit' # ->(_) { exit }
|
151
164
|
},
|
152
165
|
{
|
153
166
|
description: 'Show current configuration values',
|
154
167
|
short_name: '0',
|
155
|
-
|
168
|
+
procname: 'show_config'
|
156
169
|
},
|
157
170
|
|
158
171
|
## commands
|
@@ -161,7 +174,7 @@ task :update_menu_yml do
|
|
161
174
|
description: 'List blocks',
|
162
175
|
long_name: 'list-blocks',
|
163
176
|
opt_name: 'list_blocks',
|
164
|
-
|
177
|
+
procname: 'val_as_bool'
|
165
178
|
},
|
166
179
|
{
|
167
180
|
description: 'List default configuration as environment variables',
|
@@ -177,49 +190,49 @@ task :update_menu_yml do
|
|
177
190
|
description: 'List docs in current folder',
|
178
191
|
long_name: 'list-docs',
|
179
192
|
opt_name: 'list_docs',
|
180
|
-
|
193
|
+
procname: 'val_as_bool'
|
181
194
|
},
|
182
195
|
{
|
183
196
|
description: 'List recent saved output',
|
184
197
|
long_name: 'list-recent-output',
|
185
198
|
opt_name: 'list_recent_output',
|
186
|
-
|
199
|
+
procname: 'val_as_bool'
|
187
200
|
},
|
188
201
|
{
|
189
202
|
description: 'List recent saved scripts',
|
190
203
|
long_name: 'list-recent-scripts',
|
191
204
|
opt_name: 'list_recent_scripts',
|
192
|
-
|
205
|
+
procname: 'val_as_bool'
|
193
206
|
},
|
194
207
|
{
|
195
208
|
description: 'Select and execute a recently saved output',
|
196
209
|
long_name: 'select-recent-output',
|
197
210
|
opt_name: 'select_recent_output',
|
198
|
-
|
211
|
+
procname: 'val_as_bool'
|
199
212
|
},
|
200
213
|
{
|
201
214
|
description: 'Select and execute a recently saved script',
|
202
215
|
long_name: 'select-recent-script',
|
203
216
|
opt_name: 'select_recent_script',
|
204
|
-
|
217
|
+
procname: 'val_as_bool'
|
205
218
|
},
|
206
219
|
{
|
207
220
|
description: 'List tab completions',
|
208
221
|
long_name: 'tab-completions',
|
209
222
|
opt_name: 'tab_completions',
|
210
|
-
|
223
|
+
procname: 'val_as_bool'
|
211
224
|
},
|
212
225
|
{
|
213
226
|
description: 'Run most recently saved script',
|
214
227
|
long_name: 'run-last-script',
|
215
228
|
opt_name: 'run_last_script',
|
216
|
-
|
229
|
+
procname: 'val_as_bool'
|
217
230
|
},
|
218
231
|
{
|
219
232
|
description: 'Gem home folder',
|
220
233
|
long_name: 'pwd',
|
221
234
|
opt_name: 'pwd',
|
222
|
-
|
235
|
+
procname: 'val_as_bool'
|
223
236
|
},
|
224
237
|
|
225
238
|
## secondary options
|
@@ -231,7 +244,7 @@ task :update_menu_yml do
|
|
231
244
|
env_var: 'MDE_DISPLAY_LEVEL',
|
232
245
|
long_name: 'display-level',
|
233
246
|
opt_name: 'display_level',
|
234
|
-
|
247
|
+
procname: 'val_as_int'
|
235
248
|
},
|
236
249
|
{
|
237
250
|
arg_name: 'INT.1-',
|
@@ -240,7 +253,7 @@ task :update_menu_yml do
|
|
240
253
|
env_var: 'MDE_LIST_COUNT',
|
241
254
|
long_name: 'list-count',
|
242
255
|
opt_name: 'list_count',
|
243
|
-
|
256
|
+
procname: 'val_as_int'
|
244
257
|
},
|
245
258
|
{
|
246
259
|
arg_name: 'PREFIX',
|
@@ -249,7 +262,7 @@ task :update_menu_yml do
|
|
249
262
|
env_var: 'MDE_LOGGED_STDOUT_FILENAME_PREFIX',
|
250
263
|
# long_name: 'logged-stdout-filename-prefix',
|
251
264
|
opt_name: 'logged_stdout_filename_prefix',
|
252
|
-
|
265
|
+
procname: 'val_as_str'
|
253
266
|
},
|
254
267
|
{
|
255
268
|
arg_name: 'BOOL',
|
@@ -258,7 +271,7 @@ task :update_menu_yml do
|
|
258
271
|
env_var: 'MDE_MENU_BLOCKS_WITH_DOCNAME',
|
259
272
|
# long_name: 'menu-blocks-with-docname',
|
260
273
|
opt_name: 'menu_blocks_with_docname',
|
261
|
-
|
274
|
+
procname: 'val_as_bool'
|
262
275
|
},
|
263
276
|
{
|
264
277
|
arg_name: 'BOOL',
|
@@ -267,7 +280,7 @@ task :update_menu_yml do
|
|
267
280
|
env_var: 'MDE_MENU_BLOCKS_WITH_HEADINGS',
|
268
281
|
# long_name: 'menu-blocks-with-headings',
|
269
282
|
opt_name: 'menu_blocks_with_headings',
|
270
|
-
|
283
|
+
procname: 'val_as_bool'
|
271
284
|
},
|
272
285
|
{
|
273
286
|
arg_name: 'BOOL',
|
@@ -276,7 +289,7 @@ task :update_menu_yml do
|
|
276
289
|
env_var: 'MDE_OUTPUT_EXECUTION_SUMMARY',
|
277
290
|
long_name: 'output-execution-summary',
|
278
291
|
opt_name: 'output_execution_summary',
|
279
|
-
|
292
|
+
procname: 'val_as_bool'
|
280
293
|
},
|
281
294
|
{
|
282
295
|
arg_name: 'BOOL',
|
@@ -285,7 +298,7 @@ task :update_menu_yml do
|
|
285
298
|
env_var: 'MDE_OUTPUT_SCRIPT',
|
286
299
|
long_name: 'output-script',
|
287
300
|
opt_name: 'output_script',
|
288
|
-
|
301
|
+
procname: 'val_as_bool'
|
289
302
|
},
|
290
303
|
{
|
291
304
|
arg_name: 'BOOL',
|
@@ -294,7 +307,7 @@ task :update_menu_yml do
|
|
294
307
|
env_var: 'MDE_OUTPUT_STDOUT',
|
295
308
|
long_name: 'output-stdout',
|
296
309
|
opt_name: 'output_stdout',
|
297
|
-
|
310
|
+
procname: 'val_as_bool'
|
298
311
|
},
|
299
312
|
{
|
300
313
|
arg_name: 'BOOL',
|
@@ -303,7 +316,7 @@ task :update_menu_yml do
|
|
303
316
|
env_var: 'MDE_SAVE_EXECUTED_SCRIPT',
|
304
317
|
long_name: 'save-executed-script',
|
305
318
|
opt_name: 'save_executed_script',
|
306
|
-
|
319
|
+
procname: 'val_as_bool'
|
307
320
|
},
|
308
321
|
{
|
309
322
|
arg_name: 'BOOL',
|
@@ -312,7 +325,7 @@ task :update_menu_yml do
|
|
312
325
|
env_var: 'MDE_SAVE_EXECUTION_OUTPUT',
|
313
326
|
long_name: 'save-execution-output',
|
314
327
|
opt_name: 'save_execution_output',
|
315
|
-
|
328
|
+
procname: 'val_as_bool'
|
316
329
|
},
|
317
330
|
{
|
318
331
|
arg_name: 'INT',
|
@@ -321,7 +334,7 @@ task :update_menu_yml do
|
|
321
334
|
env_var: 'MDE_SAVED_SCRIPT_CHMOD',
|
322
335
|
# long_name: 'saved-script-chmod',
|
323
336
|
opt_name: 'saved_script_chmod',
|
324
|
-
|
337
|
+
procname: 'val_as_int'
|
325
338
|
},
|
326
339
|
{
|
327
340
|
arg_name: 'PREFIX',
|
@@ -330,7 +343,7 @@ task :update_menu_yml do
|
|
330
343
|
env_var: 'MDE_SAVED_SCRIPT_FILENAME_PREFIX',
|
331
344
|
# long_name: 'saved-script-filename-prefix',
|
332
345
|
opt_name: 'saved_script_filename_prefix',
|
333
|
-
|
346
|
+
procname: 'val_as_str'
|
334
347
|
},
|
335
348
|
{
|
336
349
|
arg_name: 'RELATIVE_PATH',
|
@@ -339,7 +352,7 @@ task :update_menu_yml do
|
|
339
352
|
env_var: 'MDE_SAVED_SCRIPT_FOLDER',
|
340
353
|
long_name: 'saved-script-folder',
|
341
354
|
opt_name: 'saved_script_folder',
|
342
|
-
|
355
|
+
procname: 'val_as_str'
|
343
356
|
},
|
344
357
|
{
|
345
358
|
arg_name: 'GLOB',
|
@@ -348,7 +361,7 @@ task :update_menu_yml do
|
|
348
361
|
env_var: 'MDE_SAVED_SCRIPT_GLOB',
|
349
362
|
# long_name: 'saved-script-glob',
|
350
363
|
opt_name: 'saved_script_glob',
|
351
|
-
|
364
|
+
procname: 'val_as_str'
|
352
365
|
},
|
353
366
|
{
|
354
367
|
arg_name: 'RELATIVE_PATH',
|
@@ -357,7 +370,7 @@ task :update_menu_yml do
|
|
357
370
|
env_var: 'MDE_SAVED_STDOUT_FOLDER',
|
358
371
|
long_name: 'saved-stdout-folder',
|
359
372
|
opt_name: 'saved_stdout_folder',
|
360
|
-
|
373
|
+
procname: 'val_as_str'
|
361
374
|
},
|
362
375
|
{
|
363
376
|
arg_name: 'GLOB',
|
@@ -366,133 +379,239 @@ task :update_menu_yml do
|
|
366
379
|
env_var: 'MDE_SAVED_STDOUT_GLOB',
|
367
380
|
# long_name: 'saved-stdout-glob',
|
368
381
|
opt_name: 'saved_stdout_glob',
|
369
|
-
|
382
|
+
procname: 'val_as_str'
|
370
383
|
},
|
371
384
|
|
372
385
|
{
|
373
386
|
default: '^[\(\[].*[\)\]]$',
|
374
387
|
description: 'Pattern for blocks to hide from user-selection',
|
375
|
-
env_var: '
|
376
|
-
opt_name: '
|
377
|
-
|
388
|
+
env_var: 'MDE_BLOCK_NAME_HIDDEN_MATCH',
|
389
|
+
opt_name: 'block_name_hidden_match',
|
390
|
+
procname: 'val_as_str'
|
378
391
|
},
|
379
392
|
{
|
380
393
|
default: ':(?<title>\S+)( |$)',
|
381
394
|
env_var: 'MDE_BLOCK_NAME_MATCH',
|
382
395
|
opt_name: 'block_name_match',
|
383
|
-
|
396
|
+
procname: 'val_as_str'
|
384
397
|
},
|
385
398
|
{
|
386
399
|
default: '%\([^\)]+\)',
|
387
400
|
env_var: 'MDE_BLOCK_CALLS_SCAN',
|
388
401
|
opt_name: 'block_calls_scan',
|
389
|
-
|
402
|
+
procname: 'val_as_str'
|
390
403
|
},
|
391
404
|
{
|
392
405
|
default: '\+\S+',
|
393
406
|
env_var: 'MDE_BLOCK_REQUIRED_SCAN',
|
394
407
|
opt_name: 'block_required_scan',
|
395
|
-
|
408
|
+
procname: 'val_as_str'
|
396
409
|
},
|
397
410
|
{
|
398
411
|
default: '<(?<full>(?<type>\$)?(?<name>[A-Za-z]\S*))',
|
399
412
|
env_var: 'MDE_BLOCK_STDIN_SCAN',
|
400
413
|
opt_name: 'block_stdin_scan',
|
401
|
-
|
414
|
+
procname: 'val_as_str'
|
402
415
|
},
|
403
416
|
{
|
404
417
|
default: '>(?<full>(?<type>\$)?(?<name>[A-Za-z]\S*))',
|
405
418
|
env_var: 'MDE_BLOCK_STDOUT_SCAN',
|
406
419
|
opt_name: 'block_stdout_scan',
|
407
|
-
|
420
|
+
procname: 'val_as_str'
|
408
421
|
},
|
409
422
|
{
|
410
423
|
default: '> ',
|
411
424
|
env_var: 'MDE_DISPLAY_LEVEL_XBASE_PREFIX',
|
412
425
|
opt_name: 'display_level_xbase_prefix',
|
413
|
-
|
426
|
+
procname: 'val_as_str'
|
414
427
|
},
|
415
428
|
{
|
416
429
|
default: '^`{3,}',
|
417
430
|
env_var: 'MDE_FENCED_START_AND_END_MATCH',
|
418
431
|
opt_name: 'fenced_start_and_end_match',
|
419
|
-
|
432
|
+
procname: 'val_as_str'
|
420
433
|
},
|
421
434
|
{
|
422
435
|
default: '^`{3,}(?<shell>[^`\s]*) *(?<name>.*)$',
|
423
436
|
env_var: 'MDE_FENCED_START_EX_MATCH',
|
424
437
|
opt_name: 'fenced_start_ex_match',
|
425
|
-
|
438
|
+
procname: 'val_as_str'
|
426
439
|
},
|
427
440
|
{
|
428
441
|
default: '^# *(?<name>[^#]*?) *$',
|
429
442
|
env_var: 'MDE_HEADING1_MATCH',
|
430
443
|
opt_name: 'heading1_match',
|
431
|
-
|
444
|
+
procname: 'val_as_str'
|
432
445
|
},
|
433
446
|
{
|
434
447
|
default: '^## *(?<name>[^#]*?) *$',
|
435
448
|
env_var: 'MDE_HEADING2_MATCH',
|
436
449
|
opt_name: 'heading2_match',
|
437
|
-
|
450
|
+
procname: 'val_as_str'
|
438
451
|
},
|
439
452
|
{
|
440
453
|
default: '^### *(?<name>.+?) *$',
|
441
454
|
env_var: 'MDE_HEADING3_MATCH',
|
442
455
|
opt_name: 'heading3_match',
|
443
|
-
|
456
|
+
procname: 'val_as_str'
|
444
457
|
},
|
445
458
|
{
|
446
459
|
default: '*.[Mm][Dd]',
|
447
460
|
env_var: 'MDE_MD_FILENAME_GLOB',
|
448
461
|
opt_name: 'md_filename_glob',
|
449
|
-
|
462
|
+
procname: 'val_as_str'
|
450
463
|
},
|
451
464
|
{
|
452
465
|
default: '.+\\.md',
|
453
466
|
env_var: 'MDE_MD_FILENAME_MATCH',
|
454
467
|
opt_name: 'md_filename_match',
|
455
|
-
|
468
|
+
procname: 'val_as_str'
|
469
|
+
},
|
470
|
+
{
|
471
|
+
default: '-:= %s =:-',
|
472
|
+
description: 'format for menu dividers and demarcations',
|
473
|
+
env_var: 'MDE_MENU_DIVIDER_FORMAT',
|
474
|
+
opt_name: 'menu_divider_format',
|
475
|
+
procname: 'val_as_str'
|
476
|
+
},
|
477
|
+
{
|
478
|
+
default: 'magenta',
|
479
|
+
description: 'Color of menu divider',
|
480
|
+
env_var: 'MDE_MENU_DIVIDER_COLOR',
|
481
|
+
opt_name: 'menu_divider_color',
|
482
|
+
procname: 'val_as_str'
|
456
483
|
},
|
457
484
|
{
|
458
485
|
default: '^::: +(?<name>.+?)$',
|
459
486
|
description: 'Pattern for topics/dividers in block selection menu',
|
460
487
|
env_var: 'MDE_MENU_DIVIDER_MATCH',
|
461
488
|
opt_name: 'menu_divider_match',
|
462
|
-
|
489
|
+
procname: 'val_as_str'
|
490
|
+
},
|
491
|
+
{
|
492
|
+
default: '>',
|
493
|
+
description: 'Symbol before each divider',
|
494
|
+
env_var: 'MDE_MENU_DIVIDER_SYMBOL',
|
495
|
+
opt_name: 'menu_divider_symbol',
|
496
|
+
procname: 'val_as_str'
|
497
|
+
},
|
498
|
+
{
|
499
|
+
default: '~~~',
|
500
|
+
description: 'closing demarcations for menu',
|
501
|
+
env_var: 'MDE_MENU_FINAL_DIVIDER',
|
502
|
+
opt_name: 'menu_final_divider',
|
503
|
+
procname: 'val_as_str'
|
504
|
+
},
|
505
|
+
{
|
506
|
+
default: '',
|
507
|
+
description: 'opening demarcation for menu',
|
508
|
+
env_var: 'MDE_MENU_INITIAL_DIVIDER',
|
509
|
+
opt_name: 'menu_initial_divider',
|
510
|
+
procname: 'val_as_str'
|
463
511
|
},
|
464
512
|
{
|
465
513
|
description: 'Options for viewing saved output file',
|
466
514
|
env_var: 'MDE_OUTPUT_VIEWER_OPTIONS',
|
467
515
|
opt_name: 'output_viewer_options',
|
468
|
-
|
516
|
+
procname: 'val_as_str'
|
469
517
|
},
|
470
518
|
{
|
471
|
-
default:
|
519
|
+
default: 36,
|
472
520
|
description: 'Maximum # of rows in select list',
|
473
521
|
env_var: 'MDE_SELECT_PAGE_HEIGHT',
|
474
522
|
opt_name: 'select_page_height',
|
475
|
-
|
523
|
+
procname: 'val_as_int'
|
476
524
|
},
|
477
525
|
{
|
478
526
|
default: '#!/usr/bin/env',
|
479
527
|
description: 'Shebang for saved scripts',
|
480
528
|
env_var: 'MDE_SHEBANG',
|
481
529
|
opt_name: 'shebang',
|
482
|
-
|
530
|
+
procname: 'val_as_str'
|
483
531
|
},
|
484
532
|
{
|
485
533
|
default: 'bash',
|
486
534
|
description: 'Shell for launched scripts',
|
487
535
|
env_var: 'MDE_SHELL',
|
488
536
|
opt_name: 'shell',
|
489
|
-
|
537
|
+
procname: 'val_as_str'
|
490
538
|
},
|
491
539
|
{
|
492
|
-
default: '
|
493
|
-
|
494
|
-
|
495
|
-
|
540
|
+
default: 'Process?',
|
541
|
+
description: 'Prompt to approve a block',
|
542
|
+
env_var: 'MDE_PROMPT_APPROVE_BLOCK',
|
543
|
+
opt_name: 'prompt_approve_block',
|
544
|
+
procname: 'val_as_str'
|
545
|
+
},
|
546
|
+
{
|
547
|
+
default: 'Choose a block:',
|
548
|
+
description: 'Prompt to select a block',
|
549
|
+
env_var: 'MDE_PROMPT_SELECT_BLOCK',
|
550
|
+
opt_name: 'prompt_select_block',
|
551
|
+
procname: 'val_as_str'
|
552
|
+
},
|
553
|
+
{
|
554
|
+
default: 'Choose a file:',
|
555
|
+
description: 'Prompt to select a markdown document',
|
556
|
+
env_var: 'MDE_PROMPT_SELECT_MD',
|
557
|
+
opt_name: 'prompt_select_md',
|
558
|
+
procname: 'val_as_str'
|
559
|
+
},
|
560
|
+
{
|
561
|
+
default: 'Choose a file:',
|
562
|
+
description: 'Prompt to select a saved file',
|
563
|
+
env_var: 'MDE_PROMPT_SELECT_OUTPUT',
|
564
|
+
opt_name: 'prompt_select_output',
|
565
|
+
procname: 'val_as_str'
|
566
|
+
},
|
567
|
+
{
|
568
|
+
default: 'Copy script to clipboard',
|
569
|
+
description: 'Prompt to copy script to clipboard',
|
570
|
+
env_var: 'MDE_PROMPT_SCRIPT_TO_CLIPBOARD',
|
571
|
+
opt_name: 'prompt_script_to_clipboard',
|
572
|
+
procname: 'val_as_str'
|
573
|
+
},
|
574
|
+
{
|
575
|
+
default: 'Save script',
|
576
|
+
description: 'Prompt to save script',
|
577
|
+
env_var: 'MDE_PROMPT_SAVE_SCRIPT',
|
578
|
+
opt_name: 'prompt_save_script',
|
579
|
+
procname: 'val_as_str'
|
580
|
+
},
|
581
|
+
{
|
582
|
+
default: 'No',
|
583
|
+
description: 'Prompt for no',
|
584
|
+
env_var: 'MDE_PROMPT_NO',
|
585
|
+
opt_name: 'prompt_no',
|
586
|
+
procname: 'val_as_str'
|
587
|
+
},
|
588
|
+
{
|
589
|
+
default: 'Yes',
|
590
|
+
description: 'Prompt for yes',
|
591
|
+
env_var: 'MDE_PROMPT_YES',
|
592
|
+
opt_name: 'prompt_yes',
|
593
|
+
procname: 'val_as_str'
|
594
|
+
},
|
595
|
+
{
|
596
|
+
default: ' #=#=#',
|
597
|
+
description: 'Output divider',
|
598
|
+
env_var: 'MDE_OUTPUT_DIVIDER',
|
599
|
+
opt_name: 'output_divider',
|
600
|
+
procname: 'val_as_str'
|
601
|
+
},
|
602
|
+
{
|
603
|
+
default: 'yellow',
|
604
|
+
description: 'Color of output divider',
|
605
|
+
env_var: 'MDE_OUTPUT_DIVIDER_COLOR',
|
606
|
+
opt_name: 'output_divider_color',
|
607
|
+
procname: 'val_as_str'
|
608
|
+
# },
|
609
|
+
# {
|
610
|
+
# default: '',
|
611
|
+
# description: '',
|
612
|
+
# env_var: 'MDE_PROMPT_',
|
613
|
+
# opt_name: 'prompt_',
|
614
|
+
# procname: 'val_as_str'
|
496
615
|
}
|
497
616
|
]
|
498
617
|
|
@@ -511,8 +630,8 @@ def update_tab_completion(target)
|
|
511
630
|
|
512
631
|
svhs = YAML.load File.open(MENU_YML)
|
513
632
|
svhs.each do |svh|
|
514
|
-
svh[:compreply] = value_for_cli(svh[:default]) if svh[:compreply].nil?
|
515
|
-
end.tap_inspect name: :svhs,
|
633
|
+
svh[:compreply] = CLI::value_for_cli(svh[:default]) if svh[:compreply].nil?
|
634
|
+
end.tap_inspect name: :svhs, type: :yaml
|
516
635
|
|
517
636
|
File.write target, ERB.new(File.read(filespec = File.join(BF, 'tab_completion.sh.erb'))).result(binding)
|
518
637
|
puts `stat #{filespec}`
|
data/bin/tab_completion.sh
CHANGED
@@ -13,7 +13,7 @@ __filedirs_all()
|
|
13
13
|
}
|
14
14
|
|
15
15
|
_mde_echo_version() {
|
16
|
-
echo "1.3.
|
16
|
+
echo "1.3.1"
|
17
17
|
}
|
18
18
|
|
19
19
|
_mde() {
|
@@ -34,12 +34,20 @@ _mde() {
|
|
34
34
|
|
35
35
|
--debug) COMPREPLY="0"; return 0 ;;
|
36
36
|
|
37
|
+
-d) COMPREPLY="0"; return 0 ;;
|
38
|
+
|
37
39
|
--filename) COMPREPLY="."; return 0 ;;
|
38
40
|
|
41
|
+
-f) COMPREPLY="."; return 0 ;;
|
42
|
+
|
39
43
|
--path) COMPREPLY="."; return 0 ;;
|
40
44
|
|
45
|
+
-p) COMPREPLY="."; return 0 ;;
|
46
|
+
|
41
47
|
--user-must-approve) COMPREPLY="1"; return 0 ;;
|
42
48
|
|
49
|
+
-q) COMPREPLY="1"; return 0 ;;
|
50
|
+
|
43
51
|
--display-level) COMPREPLY="1"; return 0 ;;
|
44
52
|
|
45
53
|
--list-count) COMPREPLY="32"; return 0 ;;
|
@@ -81,17 +89,27 @@ _mde() {
|
|
81
89
|
|
82
90
|
--block-name) COMPREPLY=".NAME."; return 0 ;;
|
83
91
|
|
92
|
+
-b) COMPREPLY=".NAME."; return 0 ;;
|
93
|
+
|
84
94
|
--config) COMPREPLY=".PATH."; return 0 ;;
|
85
95
|
|
86
96
|
--debug) COMPREPLY=".BOOL."; return 0 ;;
|
87
97
|
|
98
|
+
-d) COMPREPLY=".BOOL."; return 0 ;;
|
99
|
+
|
88
100
|
--filename) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
89
101
|
|
102
|
+
-f) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
103
|
+
|
90
104
|
--path) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
91
105
|
|
106
|
+
-p) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
107
|
+
|
92
108
|
--user-must-approve) COMPREPLY=".BOOL."; return 0 ;;
|
93
109
|
|
94
|
-
|
110
|
+
-q) COMPREPLY=".BOOL."; return 0 ;;
|
111
|
+
|
112
|
+
--display-level) COMPREPLY=".INT.0-3."; return 0 ;;
|
95
113
|
|
96
114
|
--list-count) COMPREPLY=".INT.1-."; return 0 ;;
|
97
115
|
|
@@ -120,4 +138,4 @@ _mde() {
|
|
120
138
|
|
121
139
|
complete -o filenames -o nospace -F _mde mde
|
122
140
|
# _mde_echo_version
|
123
|
-
# echo "Updated: 2022-
|
141
|
+
# echo "Updated: 2022-10-29 23:24:15 UTC"
|