markdown_exec 1.8.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/bin/tab_completion.sh +2 -2
- data/examples/colors.md +37 -20
- data/lib/ansi_formatter.rb +0 -3
- data/lib/hash_delegator.rb +320 -344
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +12 -18
- data/lib/mdoc.rb +0 -4
- data/lib/menu.src.yml +19 -19
- data/lib/menu.yml +20 -20
- metadata +1 -1
data/lib/markdown_exec.rb
CHANGED
@@ -222,7 +222,7 @@ module MarkdownExec
|
|
222
222
|
# Reports and executes block logic
|
223
223
|
def execute_block_logic(files)
|
224
224
|
@options[:filename] = select_document_if_multiple(files)
|
225
|
-
@options.
|
225
|
+
@options.select_execute_bash_and_special_blocks
|
226
226
|
end
|
227
227
|
|
228
228
|
## Executes the block specified in the options
|
@@ -244,17 +244,17 @@ module MarkdownExec
|
|
244
244
|
|
245
245
|
simple_commands = {
|
246
246
|
doc_glob: -> { @fout.fout options[:md_filename_glob] },
|
247
|
-
list_blocks: -> { list_blocks },
|
247
|
+
# list_blocks: -> { list_blocks },
|
248
|
+
list_default_env: -> { @fout.fout_list list_default_env },
|
248
249
|
list_default_yaml: -> { @fout.fout_list list_default_yaml },
|
249
250
|
list_docs: -> { @fout.fout_list files },
|
250
|
-
|
251
|
-
list_recent_output: lambda {
|
251
|
+
list_recent_output: -> {
|
252
252
|
@fout.fout_list list_recent_output(
|
253
253
|
@options[:saved_stdout_folder],
|
254
254
|
@options[:saved_stdout_glob], @options[:list_count]
|
255
255
|
)
|
256
256
|
},
|
257
|
-
list_recent_scripts:
|
257
|
+
list_recent_scripts: -> {
|
258
258
|
@fout.fout_list list_recent_scripts(
|
259
259
|
options[:saved_script_folder],
|
260
260
|
options[:saved_script_glob], options[:list_count]
|
@@ -358,17 +358,14 @@ module MarkdownExec
|
|
358
358
|
def lambda_for_procname(procname, options)
|
359
359
|
case procname
|
360
360
|
when 'debug'
|
361
|
-
->(value) {
|
362
|
-
tap_config value: value
|
363
|
-
}
|
361
|
+
->(value) { tap_config value: value }
|
364
362
|
when 'exit'
|
365
363
|
->(_) { exit }
|
366
|
-
|
367
364
|
when 'find'
|
368
365
|
->(value) {
|
369
|
-
|
370
|
-
|
371
|
-
|
366
|
+
@fout.fout 'Searching in: ' \
|
367
|
+
"#{HashDelegator.new(@options).string_send_color(@options[:path],
|
368
|
+
:menu_chrome_color)}"
|
372
369
|
searcher = DirectorySearcher.new(value, [@options[:path]])
|
373
370
|
|
374
371
|
@fout.fout 'In directory names'
|
@@ -392,16 +389,13 @@ module MarkdownExec
|
|
392
389
|
end
|
393
390
|
exit
|
394
391
|
}
|
395
|
-
|
396
392
|
when 'help'
|
397
393
|
->(_) {
|
398
394
|
@fout.fout menu_help
|
399
395
|
exit
|
400
396
|
}
|
401
|
-
# when %w[who what where why how which when whom]
|
402
397
|
when 'how'
|
403
398
|
->(value) {
|
404
|
-
# value = 'color'
|
405
399
|
@fout.fout(list_default_yaml.select { |line| line.include? value })
|
406
400
|
exit
|
407
401
|
}
|
@@ -432,7 +426,7 @@ module MarkdownExec
|
|
432
426
|
end
|
433
427
|
end
|
434
428
|
|
435
|
-
def list_blocks; end
|
429
|
+
# def list_blocks; end
|
436
430
|
|
437
431
|
def list_default_env
|
438
432
|
menu_iter do |item|
|
@@ -568,7 +562,7 @@ module MarkdownExec
|
|
568
562
|
|
569
563
|
saved_name_split filename
|
570
564
|
@options[:save_executed_script] = false
|
571
|
-
@options.
|
565
|
+
@options.select_execute_bash_and_special_blocks
|
572
566
|
rescue StandardError
|
573
567
|
error_handler('run_last_script')
|
574
568
|
end
|
@@ -635,7 +629,7 @@ module MarkdownExec
|
|
635
629
|
|
636
630
|
saved_name_split(filename)
|
637
631
|
|
638
|
-
@options.
|
632
|
+
@options.select_execute_bash_and_special_blocks ### ({ save_executed_script: false })
|
639
633
|
end
|
640
634
|
|
641
635
|
public
|
data/lib/mdoc.rb
CHANGED
@@ -223,7 +223,6 @@ module MarkdownExec
|
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
# if tr ue
|
227
226
|
# Recursively fetches required code blocks for a given list of requirements.
|
228
227
|
#
|
229
228
|
# @param reqs [Array<String>] An array of requirements to start the recursion from.
|
@@ -247,7 +246,6 @@ module MarkdownExec
|
|
247
246
|
memo
|
248
247
|
end
|
249
248
|
|
250
|
-
# else
|
251
249
|
# Recursively fetches required code blocks for a given list of requirements.
|
252
250
|
#
|
253
251
|
# @param source [String] The name of the code block to start the recursion from.
|
@@ -273,8 +271,6 @@ module MarkdownExec
|
|
273
271
|
memo
|
274
272
|
end
|
275
273
|
|
276
|
-
# end
|
277
|
-
|
278
274
|
# Recursively collects dependencies of a given source.
|
279
275
|
# @param source [String] The name of the initial source block.
|
280
276
|
# @param memo [Hash] A memoization hash to store resolved dependencies.
|
data/lib/menu.src.yml
CHANGED
@@ -113,7 +113,7 @@
|
|
113
113
|
:opt_name: dump_selected_block
|
114
114
|
:procname: val_as_bool
|
115
115
|
|
116
|
-
- :default:
|
116
|
+
- :default: fg_rgbh_ff_00_7f
|
117
117
|
:description: Color of exception detail
|
118
118
|
:env_var: MDE_EXCEPTION_COLOR_DETAIL
|
119
119
|
:opt_name: exception_color_detail
|
@@ -125,7 +125,7 @@
|
|
125
125
|
:opt_name: exception_format_detail
|
126
126
|
:procname: val_as_str
|
127
127
|
|
128
|
-
- :default:
|
128
|
+
- :default: fg_rgbh_ff_00_00
|
129
129
|
:description: Color of exception name
|
130
130
|
:env_var: MDE_EXCEPTION_COLOR_NAME
|
131
131
|
:opt_name: exception_color_name
|
@@ -158,7 +158,7 @@
|
|
158
158
|
:opt_name: exclude_expect_blocks
|
159
159
|
:procname: val_as_bool
|
160
160
|
|
161
|
-
- :default:
|
161
|
+
- :default: fg_rgbh_7f_ff_00
|
162
162
|
:description: execution_report_preview_frame_color
|
163
163
|
:env_var: MDE_EXECUTION_REPORT_PREVIEW_FRAME_COLOR
|
164
164
|
:opt_name: execution_report_preview_frame_color
|
@@ -320,7 +320,7 @@
|
|
320
320
|
:opt_name: menu_back_at_top
|
321
321
|
:procname: val_as_bool
|
322
322
|
|
323
|
-
- :default:
|
323
|
+
- :default: fg_rgbh_00_c0_c0
|
324
324
|
:description: Color of menu bash
|
325
325
|
:env_var: MDE_MENU_BASH_COLOR
|
326
326
|
:opt_name: menu_bash_color
|
@@ -340,7 +340,7 @@
|
|
340
340
|
:opt_name: menu_blocks_with_headings
|
341
341
|
:procname: val_as_bool
|
342
342
|
|
343
|
-
- :default:
|
343
|
+
- :default: fg_rgbh_40_c0_c0
|
344
344
|
:description: Color of menu chrome
|
345
345
|
:env_var: MDE_MENU_CHROME_COLOR
|
346
346
|
:opt_name: menu_chrome_color
|
@@ -352,7 +352,7 @@
|
|
352
352
|
:opt_name: menu_chrome_format
|
353
353
|
:procname: val_as_str
|
354
354
|
|
355
|
-
- :default:
|
355
|
+
- :default: fg_rgbh_80_d0_c0
|
356
356
|
:description: Color of menu divider
|
357
357
|
:env_var: MDE_MENU_DIVIDER_COLOR
|
358
358
|
:opt_name: menu_divider_color
|
@@ -417,7 +417,7 @@
|
|
417
417
|
:opt_name: menu_initial_divider
|
418
418
|
:procname: val_as_str
|
419
419
|
|
420
|
-
- :default:
|
420
|
+
- :default: fg_rgbh_e0_e0_20
|
421
421
|
:description: Color of menu link
|
422
422
|
:env_var: MDE_MENU_LINK_COLOR
|
423
423
|
:opt_name: menu_link_color
|
@@ -429,7 +429,7 @@
|
|
429
429
|
:opt_name: menu_link_format
|
430
430
|
:procname: val_as_str
|
431
431
|
|
432
|
-
- :default:
|
432
|
+
- :default: fg_rgbh_b0_b0_b0
|
433
433
|
:description: Color of menu note
|
434
434
|
:env_var: MDE_MENU_NOTE_COLOR
|
435
435
|
:opt_name: menu_note_color
|
@@ -463,13 +463,13 @@
|
|
463
463
|
:opt_name: menu_option_exit_name
|
464
464
|
:procname: val_as_str
|
465
465
|
|
466
|
-
- :default:
|
466
|
+
- :default: fg_rgbh_ff_00_ff
|
467
467
|
:description: Color of menu opts
|
468
468
|
:env_var: MDE_MENU_OPTS_COLOR
|
469
469
|
:opt_name: menu_opts_color
|
470
470
|
:procname: val_as_str
|
471
471
|
|
472
|
-
- :default:
|
472
|
+
- :default: fg_rgbh_7f_00_ff
|
473
473
|
:description: Color of menu opts
|
474
474
|
:env_var: MDE_MENU_OPTS_SET_COLOR
|
475
475
|
:opt_name: menu_opts_set_color
|
@@ -481,7 +481,7 @@
|
|
481
481
|
:opt_name: menu_opts_set_format
|
482
482
|
:procname: val_as_str
|
483
483
|
|
484
|
-
- :default:
|
484
|
+
- :default: fg_rgbh_ff_ff_ff
|
485
485
|
:description: Color of menu task
|
486
486
|
:env_var: MDE_MENU_TASK_COLOR
|
487
487
|
:opt_name: menu_task_color
|
@@ -505,13 +505,13 @@
|
|
505
505
|
:opt_name: menu_task_symbol
|
506
506
|
:procname: val_as_str
|
507
507
|
|
508
|
-
- :default:
|
508
|
+
- :default: fg_rgbh_ff_a0_ff
|
509
509
|
:description: Color of menu vars
|
510
510
|
:env_var: MDE_MENU_VARS_COLOR
|
511
511
|
:opt_name: menu_vars_color
|
512
512
|
:procname: val_as_str
|
513
513
|
|
514
|
-
- :default:
|
514
|
+
- :default: fg_rgbh_00_ff_ff
|
515
515
|
:description: Color of menu vars
|
516
516
|
:env_var: MDE_MENU_VARS_SET_COLOR
|
517
517
|
:opt_name: menu_vars_set_color
|
@@ -558,13 +558,13 @@
|
|
558
558
|
:opt_name: output_execution_label_format
|
559
559
|
:procname: val_as_str
|
560
560
|
|
561
|
-
- :default:
|
561
|
+
- :default: fg_rgbh_00_ff_00
|
562
562
|
:description: Color of output_execution_label_name
|
563
563
|
:env_var: MDE_OUTPUT_EXECUTION_LABEL_NAME_COLOR
|
564
564
|
:opt_name: output_execution_label_name_color
|
565
565
|
:procname: val_as_str
|
566
566
|
|
567
|
-
- :default:
|
567
|
+
- :default: fg_rgbh_00_ff_00
|
568
568
|
:description: Color of output_execution_label_value
|
569
569
|
:env_var: MDE_OUTPUT_EXECUTION_LABEL_VALUE_COLOR
|
570
570
|
:opt_name: output_execution_label_value_color
|
@@ -626,7 +626,7 @@
|
|
626
626
|
:opt_name: prompt_approve_block
|
627
627
|
:procname: val_as_str
|
628
628
|
|
629
|
-
- :default:
|
629
|
+
- :default: fg_rgbh_00_ff_00
|
630
630
|
:description: Color of prompt after script execution
|
631
631
|
:env_var: MDE_PROMPT_COLOR_AFTER_SCRIPT_EXECUTION
|
632
632
|
:opt_name: prompt_color_after_script_execution
|
@@ -768,7 +768,7 @@
|
|
768
768
|
:opt_name: saved_stdout_glob
|
769
769
|
:procname: val_as_str
|
770
770
|
|
771
|
-
- :default:
|
771
|
+
- :default: fg_rgbh_00_ff_7f
|
772
772
|
:description: script_execution_frame_color
|
773
773
|
:env_var: MDE_SCRIPT_EXECUTION_FRAME_COLOR
|
774
774
|
:opt_name: script_execution_frame_color
|
@@ -786,7 +786,7 @@
|
|
786
786
|
:opt_name: script_execution_tail
|
787
787
|
:procname: val_as_str
|
788
788
|
|
789
|
-
- :default:
|
789
|
+
- :default: fg_rgbh_7f_ff_00
|
790
790
|
:description: Color of output divider
|
791
791
|
:env_var: MDE_OUTPUT_DIVIDER_COLOR
|
792
792
|
:opt_name: script_preview_frame_color
|
@@ -877,7 +877,7 @@
|
|
877
877
|
:procname: version
|
878
878
|
:short_name: v
|
879
879
|
|
880
|
-
- :default:
|
880
|
+
- :default: fg_rgbh_ff_7f_00
|
881
881
|
:description: Color of warning message
|
882
882
|
:env_var: MDE_WARNING_COLOR
|
883
883
|
:opt_name: warning_color
|
data/lib/menu.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# MDE - Markdown Executor (1.8.
|
1
|
+
# MDE - Markdown Executor (1.8.2)
|
2
2
|
---
|
3
3
|
- :description: Show current configuration values
|
4
4
|
:procname: show_config
|
@@ -95,7 +95,7 @@
|
|
95
95
|
:env_var: MDE_DUMP_SELECTED_BLOCK
|
96
96
|
:opt_name: dump_selected_block
|
97
97
|
:procname: val_as_bool
|
98
|
-
- :default:
|
98
|
+
- :default: fg_rgbh_ff_00_7f
|
99
99
|
:description: Color of exception detail
|
100
100
|
:env_var: MDE_EXCEPTION_COLOR_DETAIL
|
101
101
|
:opt_name: exception_color_detail
|
@@ -105,7 +105,7 @@
|
|
105
105
|
:env_var: MDE_EXCEPTION_FORMAT_DETAIL
|
106
106
|
:opt_name: exception_format_detail
|
107
107
|
:procname: val_as_str
|
108
|
-
- :default:
|
108
|
+
- :default: fg_rgbh_ff_00_00
|
109
109
|
:description: Color of exception name
|
110
110
|
:env_var: MDE_EXCEPTION_COLOR_NAME
|
111
111
|
:opt_name: exception_color_name
|
@@ -135,7 +135,7 @@
|
|
135
135
|
:env_var: MDE_EXCLUDE_EXPECT_BLOCKS
|
136
136
|
:opt_name: exclude_expect_blocks
|
137
137
|
:procname: val_as_bool
|
138
|
-
- :default:
|
138
|
+
- :default: fg_rgbh_7f_ff_00
|
139
139
|
:description: execution_report_preview_frame_color
|
140
140
|
:env_var: MDE_EXECUTION_REPORT_PREVIEW_FRAME_COLOR
|
141
141
|
:opt_name: execution_report_preview_frame_color
|
@@ -270,7 +270,7 @@
|
|
270
270
|
:env_var: MDE_MENU_BACK_AT_TOP
|
271
271
|
:opt_name: menu_back_at_top
|
272
272
|
:procname: val_as_bool
|
273
|
-
- :default:
|
273
|
+
- :default: fg_rgbh_00_c0_c0
|
274
274
|
:description: Color of menu bash
|
275
275
|
:env_var: MDE_MENU_BASH_COLOR
|
276
276
|
:opt_name: menu_bash_color
|
@@ -287,7 +287,7 @@
|
|
287
287
|
:env_var: MDE_MENU_BLOCKS_WITH_HEADINGS
|
288
288
|
:opt_name: menu_blocks_with_headings
|
289
289
|
:procname: val_as_bool
|
290
|
-
- :default:
|
290
|
+
- :default: fg_rgbh_40_c0_c0
|
291
291
|
:description: Color of menu chrome
|
292
292
|
:env_var: MDE_MENU_CHROME_COLOR
|
293
293
|
:opt_name: menu_chrome_color
|
@@ -297,7 +297,7 @@
|
|
297
297
|
:env_var: MDE_MENU_CHROME_FORMAT
|
298
298
|
:opt_name: menu_chrome_format
|
299
299
|
:procname: val_as_str
|
300
|
-
- :default:
|
300
|
+
- :default: fg_rgbh_80_d0_c0
|
301
301
|
:description: Color of menu divider
|
302
302
|
:env_var: MDE_MENU_DIVIDER_COLOR
|
303
303
|
:opt_name: menu_divider_color
|
@@ -352,7 +352,7 @@
|
|
352
352
|
:env_var: MDE_MENU_INITIAL_DIVIDER
|
353
353
|
:opt_name: menu_initial_divider
|
354
354
|
:procname: val_as_str
|
355
|
-
- :default:
|
355
|
+
- :default: fg_rgbh_e0_e0_20
|
356
356
|
:description: Color of menu link
|
357
357
|
:env_var: MDE_MENU_LINK_COLOR
|
358
358
|
:opt_name: menu_link_color
|
@@ -362,7 +362,7 @@
|
|
362
362
|
:env_var: MDE_MENU_LINK_FORMAT
|
363
363
|
:opt_name: menu_link_format
|
364
364
|
:procname: val_as_str
|
365
|
-
- :default:
|
365
|
+
- :default: fg_rgbh_b0_b0_b0
|
366
366
|
:description: Color of menu note
|
367
367
|
:env_var: MDE_MENU_NOTE_COLOR
|
368
368
|
:opt_name: menu_note_color
|
@@ -389,12 +389,12 @@
|
|
389
389
|
:env_var: MDE_MENU_OPTION_EXIT_NAME
|
390
390
|
:opt_name: menu_option_exit_name
|
391
391
|
:procname: val_as_str
|
392
|
-
- :default:
|
392
|
+
- :default: fg_rgbh_ff_00_ff
|
393
393
|
:description: Color of menu opts
|
394
394
|
:env_var: MDE_MENU_OPTS_COLOR
|
395
395
|
:opt_name: menu_opts_color
|
396
396
|
:procname: val_as_str
|
397
|
-
- :default:
|
397
|
+
- :default: fg_rgbh_7f_00_ff
|
398
398
|
:description: Color of menu opts
|
399
399
|
:env_var: MDE_MENU_OPTS_SET_COLOR
|
400
400
|
:opt_name: menu_opts_set_color
|
@@ -404,7 +404,7 @@
|
|
404
404
|
:env_var: MDE_MENU_OPTS_SET_FORMAT
|
405
405
|
:opt_name: menu_opts_set_format
|
406
406
|
:procname: val_as_str
|
407
|
-
- :default:
|
407
|
+
- :default: fg_rgbh_ff_ff_ff
|
408
408
|
:description: Color of menu task
|
409
409
|
:env_var: MDE_MENU_TASK_COLOR
|
410
410
|
:opt_name: menu_task_color
|
@@ -424,12 +424,12 @@
|
|
424
424
|
:env_var: MDE_MENU_TASK_SYMBOL
|
425
425
|
:opt_name: menu_task_symbol
|
426
426
|
:procname: val_as_str
|
427
|
-
- :default:
|
427
|
+
- :default: fg_rgbh_ff_a0_ff
|
428
428
|
:description: Color of menu vars
|
429
429
|
:env_var: MDE_MENU_VARS_COLOR
|
430
430
|
:opt_name: menu_vars_color
|
431
431
|
:procname: val_as_str
|
432
|
-
- :default:
|
432
|
+
- :default: fg_rgbh_00_ff_ff
|
433
433
|
:description: Color of menu vars
|
434
434
|
:env_var: MDE_MENU_VARS_SET_COLOR
|
435
435
|
:opt_name: menu_vars_set_color
|
@@ -469,12 +469,12 @@
|
|
469
469
|
:env_var: MDE_OUTPUT_EXECUTION_LABEL_FORMAT
|
470
470
|
:opt_name: output_execution_label_format
|
471
471
|
:procname: val_as_str
|
472
|
-
- :default:
|
472
|
+
- :default: fg_rgbh_00_ff_00
|
473
473
|
:description: Color of output_execution_label_name
|
474
474
|
:env_var: MDE_OUTPUT_EXECUTION_LABEL_NAME_COLOR
|
475
475
|
:opt_name: output_execution_label_name_color
|
476
476
|
:procname: val_as_str
|
477
|
-
- :default:
|
477
|
+
- :default: fg_rgbh_00_ff_00
|
478
478
|
:description: Color of output_execution_label_value
|
479
479
|
:env_var: MDE_OUTPUT_EXECUTION_LABEL_VALUE_COLOR
|
480
480
|
:opt_name: output_execution_label_value_color
|
@@ -531,7 +531,7 @@
|
|
531
531
|
:env_var: MDE_PROMPT_APPROVE_BLOCK
|
532
532
|
:opt_name: prompt_approve_block
|
533
533
|
:procname: val_as_str
|
534
|
-
- :default:
|
534
|
+
- :default: fg_rgbh_00_ff_00
|
535
535
|
:description: Color of prompt after script execution
|
536
536
|
:env_var: MDE_PROMPT_COLOR_AFTER_SCRIPT_EXECUTION
|
537
537
|
:opt_name: prompt_color_after_script_execution
|
@@ -658,7 +658,7 @@
|
|
658
658
|
:env_var: MDE_SAVED_STDOUT_GLOB
|
659
659
|
:opt_name: saved_stdout_glob
|
660
660
|
:procname: val_as_str
|
661
|
-
- :default:
|
661
|
+
- :default: fg_rgbh_00_ff_7f
|
662
662
|
:description: script_execution_frame_color
|
663
663
|
:env_var: MDE_SCRIPT_EXECUTION_FRAME_COLOR
|
664
664
|
:opt_name: script_execution_frame_color
|
@@ -675,7 +675,7 @@
|
|
675
675
|
:env_var: MDE_SCRIPT_EXECUTION_TAIL
|
676
676
|
:opt_name: script_execution_tail
|
677
677
|
:procname: val_as_str
|
678
|
-
- :default:
|
678
|
+
- :default: fg_rgbh_7f_ff_00
|
679
679
|
:description: Color of output divider
|
680
680
|
:env_var: MDE_OUTPUT_DIVIDER_COLOR
|
681
681
|
:opt_name: script_preview_frame_color
|
@@ -753,7 +753,7 @@
|
|
753
753
|
:long_name: version
|
754
754
|
:procname: version
|
755
755
|
:short_name: v
|
756
|
-
- :default:
|
756
|
+
- :default: fg_rgbh_ff_7f_00
|
757
757
|
:description: Color of warning message
|
758
758
|
:env_var: MDE_WARNING_COLOR
|
759
759
|
:opt_name: warning_color
|