markdown_exec 1.3.3.4 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +16 -109
- data/Gemfile.lock +1 -1
- data/Rakefile +26 -596
- data/bin/tab_completion.sh +7 -7
- data/lib/block_label.rb +82 -0
- data/lib/env_opts.rb +6 -6
- data/lib/environment_opt_parse.rb +3 -3
- data/lib/fcb.rb +133 -0
- data/lib/filter.rb +181 -0
- data/lib/markdown_block_manager.rb +195 -0
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +78 -482
- data/lib/mdoc.rb +194 -0
- data/lib/menu.src.yml +448 -0
- data/lib/menu.yml +35 -9
- data/lib/menu_options.rb +0 -0
- data/lib/menu_options.yml +0 -0
- data/lib/object_present.rb +8 -8
- data/lib/option_value.rb +88 -0
- data/lib/regexp.rb +110 -0
- data/lib/saved_assets.rb +59 -0
- data/lib/saved_files_matcher.rb +61 -0
- metadata +14 -2
data/Rakefile
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rake/testtask'
|
5
5
|
require 'erb'
|
6
|
+
require 'pry'
|
6
7
|
# require 'rspec'
|
7
8
|
require 'rubocop'
|
8
9
|
require 'yaml'
|
@@ -75,8 +76,27 @@ end
|
|
75
76
|
|
76
77
|
desc 'minitest'
|
77
78
|
task :minitest do
|
78
|
-
|
79
|
-
|
79
|
+
commands = [
|
80
|
+
'./lib/block_label.rb',
|
81
|
+
'./lib/cached_nested_file_reader.rb',
|
82
|
+
'./lib/fcb.rb',
|
83
|
+
'./lib/filter.rb',
|
84
|
+
'./lib/mdoc.rb',
|
85
|
+
'./lib/object_present.rb',
|
86
|
+
'./lib/option_value.rb',
|
87
|
+
'./lib/regexp.rb',
|
88
|
+
'./lib/saved_assets.rb',
|
89
|
+
'./lib/saved_files_matcher.rb'
|
90
|
+
]
|
91
|
+
|
92
|
+
commands.each do |command|
|
93
|
+
begin
|
94
|
+
raise "Failed: #{command}" unless system("bundle exec ruby #{command}")
|
95
|
+
rescue StandardError => e
|
96
|
+
puts "Error: #{e.message}"
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
end
|
80
100
|
end
|
81
101
|
|
82
102
|
desc 'reek'
|
@@ -90,167 +110,8 @@ private
|
|
90
110
|
#
|
91
111
|
desc 'update menu.yml'
|
92
112
|
task :update_menu_yml do
|
93
|
-
menu_options =
|
94
|
-
|
95
|
-
## priority options
|
96
|
-
#
|
97
|
-
{
|
98
|
-
arg_name: 'NAME',
|
99
|
-
compreply: false,
|
100
|
-
description: 'Name of block',
|
101
|
-
env_var: 'MDE_BLOCK_NAME',
|
102
|
-
long_name: 'block-name',
|
103
|
-
opt_name: 'block_name',
|
104
|
-
short_name: 'b',
|
105
|
-
procname: 'val_as_str'
|
106
|
-
},
|
107
|
-
{
|
108
|
-
arg_name: 'PATH',
|
109
|
-
default: '.',
|
110
|
-
description: 'Read configuration file',
|
111
|
-
long_name: 'config',
|
112
|
-
procname: 'path'
|
113
|
-
},
|
114
|
-
{
|
115
|
-
arg_name: 'BOOL',
|
116
|
-
default: false,
|
117
|
-
description: 'Debug output',
|
118
|
-
env_var: MarkdownExec::TAP_DEBUG,
|
119
|
-
long_name: 'debug',
|
120
|
-
short_name: 'd',
|
121
|
-
procname: 'debug'
|
122
|
-
},
|
123
|
-
{
|
124
|
-
arg_name: 'RELATIVE_PATH',
|
125
|
-
compreply: '.',
|
126
|
-
description: 'Name of document',
|
127
|
-
env_var: 'MDE_FILENAME',
|
128
|
-
long_name: 'filename',
|
129
|
-
opt_name: 'filename',
|
130
|
-
short_name: 'f',
|
131
|
-
procname: 'val_as_str'
|
132
|
-
},
|
133
|
-
{
|
134
|
-
description: 'App help',
|
135
|
-
long_name: 'help',
|
136
|
-
short_name: 'h',
|
137
|
-
procname: 'help'
|
138
|
-
},
|
139
|
-
{
|
140
|
-
arg_name: 'RELATIVE_PATH',
|
141
|
-
default: '.',
|
142
|
-
description: 'Path to documents',
|
143
|
-
env_var: 'MDE_PATH',
|
144
|
-
long_name: 'path',
|
145
|
-
opt_name: 'path',
|
146
|
-
short_name: 'p',
|
147
|
-
procname: 'val_as_str'
|
148
|
-
},
|
149
|
-
{
|
150
|
-
arg_name: 'BOOL',
|
151
|
-
default: true,
|
152
|
-
description: 'Pause for user to approve script',
|
153
|
-
env_var: 'MDE_USER_MUST_APPROVE',
|
154
|
-
long_name: 'user-must-approve',
|
155
|
-
opt_name: 'user_must_approve',
|
156
|
-
short_name: 'q',
|
157
|
-
procname: 'val_as_bool'
|
158
|
-
},
|
159
|
-
{
|
160
|
-
description: "Print the gem's version",
|
161
|
-
long_name: 'version',
|
162
|
-
short_name: 'v',
|
163
|
-
procname: 'version'
|
164
|
-
},
|
165
|
-
{
|
166
|
-
description: 'Exit app',
|
167
|
-
long_name: 'exit',
|
168
|
-
short_name: 'x',
|
169
|
-
procname: 'exit' # ->(_) { exit }
|
170
|
-
},
|
171
|
-
{
|
172
|
-
description: 'Show current configuration values',
|
173
|
-
short_name: '0',
|
174
|
-
procname: 'show_config'
|
175
|
-
},
|
176
|
-
|
177
|
-
## commands
|
178
|
-
#
|
179
|
-
{
|
180
|
-
description: 'List blocks',
|
181
|
-
long_name: 'list-blocks',
|
182
|
-
opt_name: 'list_blocks',
|
183
|
-
procname: 'val_as_bool'
|
184
|
-
},
|
185
|
-
{
|
186
|
-
description: 'List default configuration as environment variables',
|
187
|
-
long_name: 'list-default-env',
|
188
|
-
opt_name: 'list_default_env'
|
189
|
-
},
|
190
|
-
{
|
191
|
-
description: 'List default configuration as YAML',
|
192
|
-
long_name: 'list-default-yaml',
|
193
|
-
opt_name: 'list_default_yaml'
|
194
|
-
},
|
195
|
-
{
|
196
|
-
description: 'List docs in current folder',
|
197
|
-
long_name: 'list-docs',
|
198
|
-
opt_name: 'list_docs',
|
199
|
-
procname: 'val_as_bool'
|
200
|
-
},
|
201
|
-
{
|
202
|
-
description: 'List recent saved output',
|
203
|
-
long_name: 'list-recent-output',
|
204
|
-
opt_name: 'list_recent_output',
|
205
|
-
procname: 'val_as_bool'
|
206
|
-
},
|
207
|
-
{
|
208
|
-
description: 'List recent saved scripts',
|
209
|
-
long_name: 'list-recent-scripts',
|
210
|
-
opt_name: 'list_recent_scripts',
|
211
|
-
procname: 'val_as_bool'
|
212
|
-
},
|
213
|
-
{
|
214
|
-
description: 'Select and execute a recently saved output',
|
215
|
-
long_name: 'select-recent-output',
|
216
|
-
opt_name: 'select_recent_output',
|
217
|
-
procname: 'val_as_bool'
|
218
|
-
},
|
219
|
-
{
|
220
|
-
description: 'Select and execute a recently saved script',
|
221
|
-
long_name: 'select-recent-script',
|
222
|
-
opt_name: 'select_recent_script',
|
223
|
-
procname: 'val_as_bool'
|
224
|
-
},
|
225
|
-
{
|
226
|
-
description: 'List tab completions',
|
227
|
-
long_name: 'tab-completions',
|
228
|
-
opt_name: 'tab_completions',
|
229
|
-
procname: 'val_as_bool'
|
230
|
-
},
|
231
|
-
{
|
232
|
-
description: 'Run most recently saved script',
|
233
|
-
long_name: 'run-last-script',
|
234
|
-
opt_name: 'run_last_script',
|
235
|
-
procname: 'val_as_bool'
|
236
|
-
},
|
237
|
-
{
|
238
|
-
description: 'Gem home folder',
|
239
|
-
long_name: 'pwd',
|
240
|
-
opt_name: 'pwd',
|
241
|
-
procname: 'val_as_bool'
|
242
|
-
},
|
243
|
-
|
244
|
-
## secondary options
|
245
|
-
#
|
246
|
-
{
|
247
|
-
arg_name: 'BOOL',
|
248
|
-
default: false,
|
249
|
-
description: 'Display only blocks of type "bash"',
|
250
|
-
env_var: 'MDE_BASH_ONLY',
|
251
|
-
opt_name: 'bash_only',
|
252
|
-
procname: 'val_as_bool'
|
253
|
-
},
|
113
|
+
menu_options = YAML.load_file('lib/menu.src.yml')
|
114
|
+
menu_options.push(
|
254
115
|
{
|
255
116
|
arg_name: "INT.#{DISPLAY_LEVEL_BASE}-#{DISPLAY_LEVEL_MAX}",
|
256
117
|
default: DISPLAY_LEVEL_DEFAULT,
|
@@ -261,439 +122,8 @@ task :update_menu_yml do
|
|
261
122
|
long_name: 'display-level',
|
262
123
|
opt_name: 'display_level',
|
263
124
|
procname: 'val_as_int'
|
264
|
-
},
|
265
|
-
{
|
266
|
-
arg_name: 'REGEX',
|
267
|
-
default: nil,
|
268
|
-
description: 'Exclude blocks with name matching',
|
269
|
-
env_var: 'MDE_EXCLUDE_BY_NAME_REGEX',
|
270
|
-
opt_name: 'exclude_by_name_regex',
|
271
|
-
procname: 'val_as_str'
|
272
|
-
},
|
273
|
-
{
|
274
|
-
arg_name: 'REGEX',
|
275
|
-
default: nil,
|
276
|
-
description: 'Exclude blocks with shell matching',
|
277
|
-
env_var: 'MDE_EXCLUDE_BY_SHELL_REGEX',
|
278
|
-
opt_name: 'exclude_by_shell_regex',
|
279
|
-
procname: 'val_as_str'
|
280
|
-
},
|
281
|
-
{
|
282
|
-
arg_name: 'BOOL',
|
283
|
-
default: true,
|
284
|
-
description: 'Hide all blocks of type "expect"',
|
285
|
-
env_var: 'MDE_EXCLUDE_EXPECT_BLOCKS',
|
286
|
-
opt_name: 'exclude_expect_blocks',
|
287
|
-
procname: 'val_as_bool'
|
288
|
-
},
|
289
|
-
{
|
290
|
-
arg_name: 'BOOL',
|
291
|
-
default: true,
|
292
|
-
description: 'Exclude blocks with name matching expression " \
|
293
|
-
"`block_name_hidden_match`',
|
294
|
-
env_var: 'MDE_HIDE_BLOCKS_BY_NAME',
|
295
|
-
opt_name: 'hide_blocks_by_name',
|
296
|
-
procname: 'val_as_bool'
|
297
|
-
},
|
298
|
-
{
|
299
|
-
arg_name: 'INT.1-',
|
300
|
-
default: 32,
|
301
|
-
description: 'Max. items to return in list',
|
302
|
-
env_var: 'MDE_LIST_COUNT',
|
303
|
-
long_name: 'list-count',
|
304
|
-
opt_name: 'list_count',
|
305
|
-
procname: 'val_as_int'
|
306
|
-
},
|
307
|
-
{
|
308
|
-
arg_name: 'PREFIX',
|
309
|
-
default: MarkdownExec::BIN_NAME,
|
310
|
-
description: 'Name prefix for stdout files',
|
311
|
-
env_var: 'MDE_LOGGED_STDOUT_FILENAME_PREFIX',
|
312
|
-
opt_name: 'logged_stdout_filename_prefix',
|
313
|
-
procname: 'val_as_str'
|
314
|
-
},
|
315
|
-
{
|
316
|
-
arg_name: 'BOOL',
|
317
|
-
default: false,
|
318
|
-
description: 'Display document name in block selection menu',
|
319
|
-
env_var: 'MDE_MENU_BLOCKS_WITH_DOCNAME',
|
320
|
-
opt_name: 'menu_blocks_with_docname',
|
321
|
-
procname: 'val_as_bool'
|
322
|
-
},
|
323
|
-
{
|
324
|
-
arg_name: 'BOOL',
|
325
|
-
default: false,
|
326
|
-
description: 'Display headings (levels 1,2,3) in block selection menu',
|
327
|
-
env_var: 'MDE_MENU_BLOCKS_WITH_HEADINGS',
|
328
|
-
opt_name: 'menu_blocks_with_headings',
|
329
|
-
procname: 'val_as_bool'
|
330
|
-
},
|
331
|
-
{
|
332
|
-
arg_name: 'BOOL',
|
333
|
-
default: true,
|
334
|
-
description: 'Display Exit option at top of menu',
|
335
|
-
env_var: 'MDE_MENU_EXIT_AT_TOP',
|
336
|
-
opt_name: 'menu_exit_at_top',
|
337
|
-
procname: 'val_as_bool'
|
338
|
-
},
|
339
|
-
{
|
340
|
-
arg_name: 'BOOL',
|
341
|
-
default: true,
|
342
|
-
description: 'Display Exit option in menu',
|
343
|
-
env_var: 'MDE_MENU_WITH_EXIT',
|
344
|
-
opt_name: 'menu_with_exit',
|
345
|
-
procname: 'val_as_bool'
|
346
|
-
},
|
347
|
-
{
|
348
|
-
arg_name: 'BOOL',
|
349
|
-
default: false,
|
350
|
-
description: 'Display summary for execution',
|
351
|
-
env_var: 'MDE_OUTPUT_EXECUTION_SUMMARY',
|
352
|
-
long_name: 'output-execution-summary',
|
353
|
-
opt_name: 'output_execution_summary',
|
354
|
-
procname: 'val_as_bool'
|
355
|
-
},
|
356
|
-
{
|
357
|
-
arg_name: 'BOOL',
|
358
|
-
default: false,
|
359
|
-
description: 'Output saved script filename at end of execution',
|
360
|
-
env_var: 'MDE_OUTPUT_SAVED_SCRIPT_FILENAME',
|
361
|
-
opt_name: 'output_saved_script_filename',
|
362
|
-
procname: 'val_as_bool'
|
363
|
-
},
|
364
|
-
{
|
365
|
-
arg_name: 'BOOL',
|
366
|
-
default: false,
|
367
|
-
description: 'Display script prior to execution',
|
368
|
-
env_var: 'MDE_OUTPUT_SCRIPT',
|
369
|
-
long_name: 'output-script',
|
370
|
-
opt_name: 'output_script',
|
371
|
-
procname: 'val_as_bool'
|
372
|
-
},
|
373
|
-
{
|
374
|
-
arg_name: 'BOOL',
|
375
|
-
default: true,
|
376
|
-
description: 'Display standard output from execution',
|
377
|
-
env_var: 'MDE_OUTPUT_STDOUT',
|
378
|
-
long_name: 'output-stdout',
|
379
|
-
opt_name: 'output_stdout',
|
380
|
-
procname: 'val_as_bool'
|
381
|
-
},
|
382
|
-
{
|
383
|
-
arg_name: 'BOOL',
|
384
|
-
default: false,
|
385
|
-
description: 'Save executed script',
|
386
|
-
env_var: 'MDE_SAVE_EXECUTED_SCRIPT',
|
387
|
-
long_name: 'save-executed-script',
|
388
|
-
opt_name: 'save_executed_script',
|
389
|
-
procname: 'val_as_bool'
|
390
|
-
},
|
391
|
-
{
|
392
|
-
arg_name: 'BOOL',
|
393
|
-
default: false,
|
394
|
-
description: 'Save standard output of the executed script',
|
395
|
-
env_var: 'MDE_SAVE_EXECUTION_OUTPUT',
|
396
|
-
long_name: 'save-execution-output',
|
397
|
-
opt_name: 'save_execution_output',
|
398
|
-
procname: 'val_as_bool'
|
399
|
-
},
|
400
|
-
{
|
401
|
-
arg_name: 'INT',
|
402
|
-
default: 0o755,
|
403
|
-
description: 'chmod for saved scripts',
|
404
|
-
env_var: 'MDE_SAVED_SCRIPT_CHMOD',
|
405
|
-
opt_name: 'saved_script_chmod',
|
406
|
-
procname: 'val_as_int'
|
407
|
-
},
|
408
|
-
{
|
409
|
-
arg_name: 'PREFIX',
|
410
|
-
default: MarkdownExec::BIN_NAME,
|
411
|
-
description: 'Name prefix for saved scripts',
|
412
|
-
env_var: 'MDE_SAVED_SCRIPT_FILENAME_PREFIX',
|
413
|
-
opt_name: 'saved_script_filename_prefix',
|
414
|
-
procname: 'val_as_str'
|
415
|
-
},
|
416
|
-
{
|
417
|
-
arg_name: 'RELATIVE_PATH',
|
418
|
-
default: 'logs',
|
419
|
-
description: 'Saved script folder',
|
420
|
-
env_var: 'MDE_SAVED_SCRIPT_FOLDER',
|
421
|
-
long_name: 'saved-script-folder',
|
422
|
-
opt_name: 'saved_script_folder',
|
423
|
-
procname: 'val_as_str'
|
424
|
-
},
|
425
|
-
{
|
426
|
-
arg_name: 'GLOB',
|
427
|
-
default: 'mde_*.sh',
|
428
|
-
description: 'Glob matching saved scripts',
|
429
|
-
env_var: 'MDE_SAVED_SCRIPT_GLOB',
|
430
|
-
opt_name: 'saved_script_glob',
|
431
|
-
procname: 'val_as_str'
|
432
|
-
},
|
433
|
-
{
|
434
|
-
arg_name: 'RELATIVE_PATH',
|
435
|
-
default: 'logs',
|
436
|
-
description: 'Saved stdout folder',
|
437
|
-
env_var: 'MDE_SAVED_STDOUT_FOLDER',
|
438
|
-
long_name: 'saved-stdout-folder',
|
439
|
-
opt_name: 'saved_stdout_folder',
|
440
|
-
procname: 'val_as_str'
|
441
|
-
},
|
442
|
-
{
|
443
|
-
arg_name: 'GLOB',
|
444
|
-
default: 'mde_*.out.txt',
|
445
|
-
description: 'Glob matching saved outputs',
|
446
|
-
env_var: 'MDE_SAVED_STDOUT_GLOB',
|
447
|
-
opt_name: 'saved_stdout_glob',
|
448
|
-
procname: 'val_as_str'
|
449
|
-
},
|
450
|
-
{
|
451
|
-
arg_name: 'REGEX',
|
452
|
-
default: nil,
|
453
|
-
description: 'Select blocks with name matching',
|
454
|
-
env_var: 'MDE_SELECT_BY_NAME_REGEX',
|
455
|
-
opt_name: 'select_by_name_regex',
|
456
|
-
procname: 'val_as_str'
|
457
|
-
},
|
458
|
-
{
|
459
|
-
arg_name: 'REGEX',
|
460
|
-
default: nil,
|
461
|
-
description: 'Select blocks with shell matching',
|
462
|
-
env_var: 'MDE_SELECT_BY_SHELL_REGEX',
|
463
|
-
opt_name: 'select_by_shell_regex',
|
464
|
-
procname: 'val_as_str'
|
465
|
-
},
|
466
|
-
{
|
467
|
-
default: '^[\(\[].*[\)\]]$',
|
468
|
-
description: 'Pattern for blocks to hide from user-selection',
|
469
|
-
env_var: 'MDE_BLOCK_NAME_HIDDEN_MATCH',
|
470
|
-
opt_name: 'block_name_hidden_match',
|
471
|
-
procname: 'val_as_str'
|
472
|
-
},
|
473
|
-
{
|
474
|
-
default: ':(?<title>\S+)( |$)',
|
475
|
-
env_var: 'MDE_BLOCK_NAME_MATCH',
|
476
|
-
opt_name: 'block_name_match',
|
477
|
-
procname: 'val_as_str'
|
478
|
-
},
|
479
|
-
{
|
480
|
-
default: '%\([^\)]+\)',
|
481
|
-
env_var: 'MDE_BLOCK_CALLS_SCAN',
|
482
|
-
opt_name: 'block_calls_scan',
|
483
|
-
procname: 'val_as_str'
|
484
|
-
},
|
485
|
-
{
|
486
|
-
default: '\+\S+',
|
487
|
-
env_var: 'MDE_BLOCK_REQUIRED_SCAN',
|
488
|
-
opt_name: 'block_required_scan',
|
489
|
-
procname: 'val_as_str'
|
490
|
-
},
|
491
|
-
{
|
492
|
-
default: '<(?<full>(?<type>\$)?(?<name>[A-Za-z_\-\.\w]+))',
|
493
|
-
env_var: 'MDE_BLOCK_STDIN_SCAN',
|
494
|
-
opt_name: 'block_stdin_scan',
|
495
|
-
procname: 'val_as_str'
|
496
|
-
},
|
497
|
-
{
|
498
|
-
default: '>(?<full>(?<type>\$)?(?<name>[A-Za-z_\-\.\w]+))',
|
499
|
-
env_var: 'MDE_BLOCK_STDOUT_SCAN',
|
500
|
-
opt_name: 'block_stdout_scan',
|
501
|
-
procname: 'val_as_str'
|
502
|
-
},
|
503
|
-
{
|
504
|
-
default: '> ',
|
505
|
-
env_var: 'MDE_DISPLAY_LEVEL_XBASE_PREFIX',
|
506
|
-
opt_name: 'display_level_xbase_prefix',
|
507
|
-
procname: 'val_as_str'
|
508
|
-
},
|
509
|
-
{
|
510
|
-
default: '^`{3,}',
|
511
|
-
env_var: 'MDE_FENCED_START_AND_END_MATCH',
|
512
|
-
opt_name: 'fenced_start_and_end_match',
|
513
|
-
procname: 'val_as_str'
|
514
|
-
},
|
515
|
-
{
|
516
|
-
default: '^`{3,}(?<shell>[^`\s]*) *:?(?<name>[^\s]*) *(?<rest>.*) *$',
|
517
|
-
env_var: 'MDE_FENCED_START_EX_MATCH',
|
518
|
-
opt_name: 'fenced_start_ex_match',
|
519
|
-
procname: 'val_as_str'
|
520
|
-
},
|
521
|
-
{
|
522
|
-
default: '^# *(?<name>[^#]*?) *$',
|
523
|
-
env_var: 'MDE_HEADING1_MATCH',
|
524
|
-
opt_name: 'heading1_match',
|
525
|
-
procname: 'val_as_str'
|
526
|
-
},
|
527
|
-
{
|
528
|
-
default: '^## *(?<name>[^#]*?) *$',
|
529
|
-
env_var: 'MDE_HEADING2_MATCH',
|
530
|
-
opt_name: 'heading2_match',
|
531
|
-
procname: 'val_as_str'
|
532
|
-
},
|
533
|
-
{
|
534
|
-
default: '^### *(?<name>.+?) *$',
|
535
|
-
env_var: 'MDE_HEADING3_MATCH',
|
536
|
-
opt_name: 'heading3_match',
|
537
|
-
procname: 'val_as_str'
|
538
|
-
},
|
539
|
-
{
|
540
|
-
default: '^ *@import (.+)$',
|
541
|
-
env_var: 'MDE_IMPORT_PATTERN',
|
542
|
-
opt_name: 'import_pattern',
|
543
|
-
procname: 'val_as_str'
|
544
|
-
},
|
545
|
-
{
|
546
|
-
default: '*.[Mm][Dd]',
|
547
|
-
env_var: 'MDE_MD_FILENAME_GLOB',
|
548
|
-
opt_name: 'md_filename_glob',
|
549
|
-
procname: 'val_as_str'
|
550
|
-
},
|
551
|
-
{
|
552
|
-
default: '.+\\.md',
|
553
|
-
env_var: 'MDE_MD_FILENAME_MATCH',
|
554
|
-
opt_name: 'md_filename_match',
|
555
|
-
procname: 'val_as_str'
|
556
|
-
},
|
557
|
-
{
|
558
|
-
default: '-:= %s =:-',
|
559
|
-
description: 'format for menu dividers and demarcations',
|
560
|
-
env_var: 'MDE_MENU_DIVIDER_FORMAT',
|
561
|
-
opt_name: 'menu_divider_format',
|
562
|
-
procname: 'val_as_str'
|
563
|
-
},
|
564
|
-
{
|
565
|
-
default: 'magenta',
|
566
|
-
description: 'Color of menu divider',
|
567
|
-
env_var: 'MDE_MENU_DIVIDER_COLOR',
|
568
|
-
opt_name: 'menu_divider_color',
|
569
|
-
procname: 'val_as_str'
|
570
|
-
},
|
571
|
-
{
|
572
|
-
default: '^::: +(?<name>.+?)$',
|
573
|
-
description: 'Pattern for topics/dividers in block selection menu',
|
574
|
-
env_var: 'MDE_MENU_DIVIDER_MATCH',
|
575
|
-
opt_name: 'menu_divider_match',
|
576
|
-
procname: 'val_as_str'
|
577
|
-
},
|
578
|
-
{
|
579
|
-
default: '>',
|
580
|
-
description: 'Symbol before each divider',
|
581
|
-
env_var: 'MDE_MENU_DIVIDER_SYMBOL',
|
582
|
-
opt_name: 'menu_divider_symbol',
|
583
|
-
procname: 'val_as_str'
|
584
|
-
},
|
585
|
-
{
|
586
|
-
default: '~~~',
|
587
|
-
description: 'closing demarcations for menu',
|
588
|
-
env_var: 'MDE_MENU_FINAL_DIVIDER',
|
589
|
-
opt_name: 'menu_final_divider',
|
590
|
-
procname: 'val_as_str'
|
591
|
-
},
|
592
|
-
{
|
593
|
-
default: '',
|
594
|
-
description: 'opening demarcation for menu',
|
595
|
-
env_var: 'MDE_MENU_INITIAL_DIVIDER',
|
596
|
-
opt_name: 'menu_initial_divider',
|
597
|
-
procname: 'val_as_str'
|
598
|
-
},
|
599
|
-
{
|
600
|
-
description: 'Options for viewing saved output file',
|
601
|
-
env_var: 'MDE_OUTPUT_VIEWER_OPTIONS',
|
602
|
-
opt_name: 'output_viewer_options',
|
603
|
-
procname: 'val_as_str'
|
604
|
-
},
|
605
|
-
{
|
606
|
-
default: 36,
|
607
|
-
description: 'Maximum # of rows in select list',
|
608
|
-
env_var: 'MDE_SELECT_PAGE_HEIGHT',
|
609
|
-
opt_name: 'select_page_height',
|
610
|
-
procname: 'val_as_int'
|
611
|
-
},
|
612
|
-
{
|
613
|
-
default: '#!/usr/bin/env',
|
614
|
-
description: 'Shebang for saved scripts',
|
615
|
-
env_var: 'MDE_SHEBANG',
|
616
|
-
opt_name: 'shebang',
|
617
|
-
procname: 'val_as_str'
|
618
|
-
},
|
619
|
-
{
|
620
|
-
default: 'bash',
|
621
|
-
description: 'Shell for launched scripts',
|
622
|
-
env_var: 'MDE_SHELL',
|
623
|
-
opt_name: 'shell',
|
624
|
-
procname: 'val_as_str'
|
625
|
-
},
|
626
|
-
{
|
627
|
-
default: 'Process?',
|
628
|
-
description: 'Prompt to approve a block',
|
629
|
-
env_var: 'MDE_PROMPT_APPROVE_BLOCK',
|
630
|
-
opt_name: 'prompt_approve_block',
|
631
|
-
procname: 'val_as_str'
|
632
|
-
},
|
633
|
-
{
|
634
|
-
default: 'Choose a block:',
|
635
|
-
description: 'Prompt to select a block',
|
636
|
-
env_var: 'MDE_PROMPT_SELECT_BLOCK',
|
637
|
-
opt_name: 'prompt_select_block',
|
638
|
-
procname: 'val_as_str'
|
639
|
-
},
|
640
|
-
{
|
641
|
-
default: 'Choose a file:',
|
642
|
-
description: 'Prompt to select a markdown document',
|
643
|
-
env_var: 'MDE_PROMPT_SELECT_MD',
|
644
|
-
opt_name: 'prompt_select_md',
|
645
|
-
procname: 'val_as_str'
|
646
|
-
},
|
647
|
-
{
|
648
|
-
default: 'Choose a file:',
|
649
|
-
description: 'Prompt to select a saved file',
|
650
|
-
env_var: 'MDE_PROMPT_SELECT_OUTPUT',
|
651
|
-
opt_name: 'prompt_select_output',
|
652
|
-
procname: 'val_as_str'
|
653
|
-
},
|
654
|
-
{
|
655
|
-
default: 'Copy script to clipboard',
|
656
|
-
description: 'Prompt to copy script to clipboard',
|
657
|
-
env_var: 'MDE_PROMPT_SCRIPT_TO_CLIPBOARD',
|
658
|
-
opt_name: 'prompt_script_to_clipboard',
|
659
|
-
procname: 'val_as_str'
|
660
|
-
},
|
661
|
-
{
|
662
|
-
default: 'Save script',
|
663
|
-
description: 'Prompt to save script',
|
664
|
-
env_var: 'MDE_PROMPT_SAVE_SCRIPT',
|
665
|
-
opt_name: 'prompt_save_script',
|
666
|
-
procname: 'val_as_str'
|
667
|
-
},
|
668
|
-
{
|
669
|
-
default: 'No',
|
670
|
-
description: 'Prompt for no',
|
671
|
-
env_var: 'MDE_PROMPT_NO',
|
672
|
-
opt_name: 'prompt_no',
|
673
|
-
procname: 'val_as_str'
|
674
|
-
},
|
675
|
-
{
|
676
|
-
default: 'Yes',
|
677
|
-
description: 'Prompt for yes',
|
678
|
-
env_var: 'MDE_PROMPT_YES',
|
679
|
-
opt_name: 'prompt_yes',
|
680
|
-
procname: 'val_as_str'
|
681
|
-
},
|
682
|
-
{
|
683
|
-
default: ' #=#=#',
|
684
|
-
description: 'Output divider',
|
685
|
-
env_var: 'MDE_OUTPUT_DIVIDER',
|
686
|
-
opt_name: 'output_divider',
|
687
|
-
procname: 'val_as_str'
|
688
|
-
},
|
689
|
-
{
|
690
|
-
default: 'yellow',
|
691
|
-
description: 'Color of output divider',
|
692
|
-
env_var: 'MDE_OUTPUT_DIVIDER_COLOR',
|
693
|
-
opt_name: 'output_divider_color',
|
694
|
-
procname: 'val_as_str'
|
695
125
|
}
|
696
|
-
|
126
|
+
)
|
697
127
|
|
698
128
|
File.write(MENU_YML,
|
699
129
|
"# #{MarkdownExec::APP_NAME} - #{MarkdownExec::APP_DESC} " \
|
@@ -712,7 +142,7 @@ def update_tab_completion(target)
|
|
712
142
|
svhs = YAML.load File.open(MENU_YML)
|
713
143
|
svhs.each do |svh|
|
714
144
|
svh[:compreply] = CLI.value_for_cli(svh[:default]) if svh[:compreply].nil?
|
715
|
-
end
|
145
|
+
end
|
716
146
|
|
717
147
|
File.write target,
|
718
148
|
ERB.new(File.read(filespec = File.join(BF,
|
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.6"
|
17
17
|
}
|
18
18
|
|
19
19
|
_mde() {
|
@@ -48,8 +48,6 @@ _mde() {
|
|
48
48
|
|
49
49
|
-q) COMPREPLY="1"; return 0 ;;
|
50
50
|
|
51
|
-
--display-level) COMPREPLY="1"; return 0 ;;
|
52
|
-
|
53
51
|
--list-count) COMPREPLY="32"; return 0 ;;
|
54
52
|
|
55
53
|
--output-execution-summary) COMPREPLY="0"; return 0 ;;
|
@@ -66,6 +64,8 @@ _mde() {
|
|
66
64
|
|
67
65
|
--saved-stdout-folder) COMPREPLY="logs"; return 0 ;;
|
68
66
|
|
67
|
+
--display-level) COMPREPLY="1"; return 0 ;;
|
68
|
+
|
69
69
|
esac
|
70
70
|
fi
|
71
71
|
fi
|
@@ -74,7 +74,7 @@ _mde() {
|
|
74
74
|
# present matching option names
|
75
75
|
#
|
76
76
|
if [[ ${cur} == -* ]] ; then
|
77
|
-
opts=("--block-name" "--config" "--debug" "--filename" "--help" "--path" "--user-must-approve" "--version" "--exit" "--list-blocks" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--select-recent-output" "--select-recent-script" "--tab-completions" "--run-last-script" "--pwd" "--
|
77
|
+
opts=("--block-name" "--config" "--debug" "--filename" "--help" "--path" "--user-must-approve" "--version" "--exit" "--list-blocks" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--select-recent-output" "--select-recent-script" "--tab-completions" "--run-last-script" "--pwd" "--list-count" "--output-execution-summary" "--output-script" "--output-stdout" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--display-level")
|
78
78
|
COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
|
79
79
|
|
80
80
|
return 0
|
@@ -109,8 +109,6 @@ _mde() {
|
|
109
109
|
|
110
110
|
-q) COMPREPLY=".BOOL."; return 0 ;;
|
111
111
|
|
112
|
-
--display-level) COMPREPLY=".INT.0-3."; return 0 ;;
|
113
|
-
|
114
112
|
--list-count) COMPREPLY=".INT.1-."; return 0 ;;
|
115
113
|
|
116
114
|
--output-execution-summary) COMPREPLY=".BOOL."; return 0 ;;
|
@@ -127,6 +125,8 @@ _mde() {
|
|
127
125
|
|
128
126
|
--saved-stdout-folder) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
129
127
|
|
128
|
+
--display-level) COMPREPLY=".INT.0-3."; return 0 ;;
|
129
|
+
|
130
130
|
esac
|
131
131
|
fi
|
132
132
|
|
@@ -138,4 +138,4 @@ _mde() {
|
|
138
138
|
|
139
139
|
complete -o filenames -o nospace -F _mde mde
|
140
140
|
# _mde_echo_version
|
141
|
-
# echo "Updated: 2023-10-
|
141
|
+
# echo "Updated: 2023-10-15 15:31:41 UTC"
|