markdown_exec 2.0.5 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -2
- data/CHANGELOG.md +48 -0
- data/Gemfile.lock +1 -1
- data/bin/tab_completion.sh +15 -31
- data/examples/block_names.md +23 -0
- data/examples/interrupt.md +9 -0
- data/examples/line-wrapping.md +17 -0
- data/examples/linked.md +8 -0
- data/examples/linked_show.md +7 -0
- data/examples/load_code.md +10 -0
- data/examples/nickname.md +46 -9
- data/examples/pause-after-execution.md +9 -0
- data/lib/color_scheme.rb +65 -0
- data/lib/colorize.rb +25 -0
- data/lib/constants.rb +19 -19
- data/lib/fcb.rb +15 -0
- data/lib/find_files.rb +35 -39
- data/lib/hash_delegator.rb +1239 -761
- data/lib/input_sequencer.rb +11 -4
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +16 -6
- data/lib/mdoc.rb +9 -14
- data/lib/menu.src.yml +106 -24
- data/lib/menu.yml +93 -25
- data/lib/saved_assets.rb +4 -3
- metadata +9 -2
data/lib/menu.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# MDE - Markdown Executor (2.0.
|
1
|
+
# MDE - Markdown Executor (2.0.7)
|
2
2
|
---
|
3
3
|
- :description: Show current configuration values
|
4
4
|
:procname: show_config
|
@@ -94,45 +94,64 @@
|
|
94
94
|
:env_var: MDE_DOCUMENT_LOAD_OPTS_BLOCK_NAME
|
95
95
|
:opt_name: document_load_opts_block_name
|
96
96
|
:procname: val_as_str
|
97
|
+
- :arg_name: GLOB
|
98
|
+
:default: document_configurations/%{document_filename}_*.sh
|
99
|
+
:description: Glob for saved lines for a document
|
100
|
+
:env_var: MDE_DOCUMENT_SAVED_LINES_GLOB
|
101
|
+
:opt_name: document_saved_lines_glob
|
102
|
+
:procname: val_as_str
|
103
|
+
- :arg_name: BOOL
|
104
|
+
:default: true
|
105
|
+
:description: Add menu options for saved lines
|
106
|
+
:env_var: MDE_MENU_FOR_SAVED_LINES
|
107
|
+
:opt_name: menu_for_saved_lines
|
108
|
+
:procname: val_as_bool
|
97
109
|
- :arg_name: BOOL
|
98
110
|
:default: false
|
99
111
|
:description: Dump @delegate_object
|
100
|
-
:
|
112
|
+
:env_var: MDE_DUMP_DELEGATE_OBJECT
|
113
|
+
:long_name: dump-delegate-object
|
101
114
|
:opt_name: dump_delegate_object
|
102
115
|
:procname: val_as_bool
|
103
116
|
- :arg_name: BOOL
|
104
117
|
:default: false
|
105
118
|
:description: Dump BlocksInFile (stage 1)
|
119
|
+
:env_var: MDE_DUMP_BLOCKS_IN_FILE
|
106
120
|
:long_name: dump-blocks-in-file
|
107
121
|
:opt_name: dump_blocks_in_file
|
108
122
|
:procname: val_as_bool
|
109
123
|
- :arg_name: BOOL
|
110
124
|
:default: false
|
111
125
|
:description: Dump inherited block_names
|
112
|
-
:
|
126
|
+
:env_var: MDE_DUMP_INHERITED_BLOCK_NAMES
|
127
|
+
:long_name: dump-inherited-block_names
|
113
128
|
:opt_name: dump_inherited_block_names
|
114
129
|
:procname: val_as_bool
|
115
130
|
- :arg_name: BOOL
|
116
131
|
:default: false
|
117
132
|
:description: Dump inherited dependencies
|
118
|
-
:
|
133
|
+
:env_var: MDE_DUMP_INHERITED_DEPENDENCIES
|
134
|
+
:long_name: dump-inherited-dependencies
|
119
135
|
:opt_name: dump_inherited_dependencies
|
120
136
|
:procname: val_as_bool
|
121
137
|
- :arg_name: BOOL
|
122
138
|
:default: false
|
123
139
|
:description: Dump inherited lines
|
124
|
-
:
|
140
|
+
:env_var: MDE_DUMP_INHERITED_LINES
|
141
|
+
:long_name: dump-inherited-lines
|
125
142
|
:opt_name: dump_inherited_lines
|
126
143
|
:procname: val_as_bool
|
127
144
|
- :arg_name: BOOL
|
128
145
|
:default: false
|
129
146
|
:description: Dump MenuBlocks (stage 2)
|
147
|
+
:env_var: MDE_DUMP_MENU_BLOCKS
|
130
148
|
:long_name: dump-menu-blocks
|
131
149
|
:opt_name: dump_menu_blocks
|
132
150
|
:procname: val_as_bool
|
133
151
|
- :arg_name: BOOL
|
134
152
|
:default: false
|
135
153
|
:description: Dump selected block
|
154
|
+
:env_var: MDE_DUMP_SELECTED_BLOCK
|
136
155
|
:long_name: dump-selected-block
|
137
156
|
:opt_name: dump_selected_block
|
138
157
|
:procname: val_as_bool
|
@@ -239,7 +258,7 @@
|
|
239
258
|
:env_var: MDE_FENCED_START_AND_END_REGEX
|
240
259
|
:opt_name: fenced_start_and_end_regex
|
241
260
|
:procname: val_as_str
|
242
|
-
- :default: "^(?<indent> *)`{3,}(?<shell>[^`\\s]*)
|
261
|
+
- :default: "^(?<indent> *)`{3,}(?<shell>[^`\\s]*) *(:(?<name>[^\\s]*))? *(?<rest>.*)
|
243
262
|
*$"
|
244
263
|
:description: Match the start of a fenced block
|
245
264
|
:env_var: MDE_FENCED_START_EXTENDED_REGEX
|
@@ -266,15 +285,15 @@
|
|
266
285
|
:long_name: find-path
|
267
286
|
:opt_name: find_path
|
268
287
|
:procname: val_as_str
|
269
|
-
- :default: "^# *(?<
|
288
|
+
- :default: "^#(?<line>(?!#)(?<indent>[ \t]*)(?<text>.*?)(?<trailing>[ \t]*))?$"
|
270
289
|
:env_var: MDE_HEADING1_MATCH
|
271
290
|
:opt_name: heading1_match
|
272
291
|
:procname: val_as_str
|
273
|
-
- :default: "^## *(?<
|
292
|
+
- :default: "^##(?<line>(?!#)(?<indent>[ \t]*)(?<text>.*?)(?<trailing>[ \t]*))?$"
|
274
293
|
:env_var: MDE_HEADING2_MATCH
|
275
294
|
:opt_name: heading2_match
|
276
295
|
:procname: val_as_str
|
277
|
-
- :default: "^### *(?<
|
296
|
+
- :default: "^###(?<line>(?<indent>[ \t]*)(?<text>.*?)(?<trailing>[ \t]*))?$"
|
278
297
|
:env_var: MDE_HEADING3_MATCH
|
279
298
|
:opt_name: heading3_match
|
280
299
|
:procname: val_as_str
|
@@ -341,6 +360,13 @@
|
|
341
360
|
:long_name: list-recent-scripts
|
342
361
|
:opt_name: list_recent_scripts
|
343
362
|
:procname: val_as_bool
|
363
|
+
- :arg_name: PATH
|
364
|
+
:default: ''
|
365
|
+
:description: Load code
|
366
|
+
:env_var: MDE_LOAD_CODE
|
367
|
+
:long_name: load-code
|
368
|
+
:opt_name: load_code
|
369
|
+
:procname: val_as_str
|
344
370
|
- :arg_name: PREFIX
|
345
371
|
:default: mde
|
346
372
|
:description: Name prefix for stdout files
|
@@ -399,7 +425,7 @@
|
|
399
425
|
:env_var: MDE_MENU_DIVIDER_FORMAT
|
400
426
|
:opt_name: menu_divider_format
|
401
427
|
:procname: val_as_str
|
402
|
-
- :default: "^:::
|
428
|
+
- :default: "^:::(?<line>(?<indent>[ \t]*)(?<text>.*?)(?<trailing>[ \t]*))?$"
|
403
429
|
:description: Pattern for topics/dividers in block selection menu
|
404
430
|
:env_var: MDE_MENU_DIVIDER_MATCH
|
405
431
|
:opt_name: menu_divider_match
|
@@ -415,38 +441,44 @@
|
|
415
441
|
:env_var: MDE_MENU_EXIT_AT_TOP
|
416
442
|
:opt_name: menu_exit_at_top
|
417
443
|
:procname: val_as_bool
|
444
|
+
- :arg_name: BOOL
|
445
|
+
:default: false
|
446
|
+
:description: Display Load option at top of menu (vs bottom)
|
447
|
+
:env_var: MDE_MENU_LOAD_AT_TOP
|
448
|
+
:opt_name: menu_load_at_top
|
449
|
+
:procname: val_as_bool
|
418
450
|
- :default:
|
419
451
|
:line: "~~~"
|
420
452
|
:description: closing demarcations for menu
|
421
453
|
:env_var: MDE_MENU_FINAL_DIVIDER
|
422
454
|
:opt_name: menu_final_divider
|
423
455
|
:procname: val_as_str
|
424
|
-
- :default:
|
456
|
+
- :default: fg_bg_rgbh_80_80_c0_10_10_20
|
425
457
|
:description: Color for heading 1 in menu
|
426
458
|
:env_var: MDE_MENU_HEADING1_COLOR
|
427
459
|
:opt_name: menu_heading1_color
|
428
460
|
:procname: val_as_str
|
429
|
-
- :default: "
|
461
|
+
- :default: "%{line}"
|
430
462
|
:description: format for menu heading1 in menu
|
431
463
|
:env_var: MDE_MENU_HEADING1_FORMAT
|
432
464
|
:opt_name: menu_heading1_format
|
433
465
|
:procname: val_as_str
|
434
|
-
- :default:
|
466
|
+
- :default: fg_bg_rgbh_60_60_c0_10_10_20
|
435
467
|
:description: Color for heading 2 in menu
|
436
468
|
:env_var: MDE_MENU_HEADING2_COLOR
|
437
469
|
:opt_name: menu_heading2_color
|
438
470
|
:procname: val_as_str
|
439
|
-
- :default: "
|
471
|
+
- :default: "%{line}"
|
440
472
|
:description: format for menu heading2 in menu
|
441
473
|
:env_var: MDE_MENU_HEADING2_FORMAT
|
442
474
|
:opt_name: menu_heading2_format
|
443
475
|
:procname: val_as_str
|
444
|
-
- :default:
|
476
|
+
- :default: fg_bg_rgbh_40_40_c0_10_10_20
|
445
477
|
:description: Color for heading 3 in menu
|
446
478
|
:env_var: MDE_MENU_HEADING3_COLOR
|
447
479
|
:opt_name: menu_heading3_color
|
448
480
|
:procname: val_as_str
|
449
|
-
- :default: "
|
481
|
+
- :default: "%{line}"
|
450
482
|
:description: format for menu heading3 in menu
|
451
483
|
:env_var: MDE_MENU_HEADING3_FORMAT
|
452
484
|
:opt_name: menu_heading3_format
|
@@ -500,7 +532,7 @@
|
|
500
532
|
:env_var: MDE_MENU_LINK_FORMAT
|
501
533
|
:opt_name: menu_link_format
|
502
534
|
:procname: val_as_str
|
503
|
-
- :default:
|
535
|
+
- :default: fg_rgbh_c0_c0_c0
|
504
536
|
:description: Color of menu note
|
505
537
|
:env_var: MDE_MENU_NOTE_COLOR
|
506
538
|
:opt_name: menu_note_color
|
@@ -510,7 +542,7 @@
|
|
510
542
|
:env_var: MDE_MENU_NOTE_FORMAT
|
511
543
|
:opt_name: menu_note_format
|
512
544
|
:procname: val_as_str
|
513
|
-
- :default: "^(?<line>(?!/ )
|
545
|
+
- :default: "^(?<line>(?!/ )(?<indent>[ \t]*)(?<text>.*?)(?<trailing>[ \t]*))?$"
|
514
546
|
:description: Pattern for notes in block selection menu
|
515
547
|
:env_var: MDE_MENU_NOTE_MATCH
|
516
548
|
:opt_name: menu_note_match
|
@@ -521,12 +553,42 @@
|
|
521
553
|
:env_var: MDE_MENU_OPTION_BACK_NAME
|
522
554
|
:opt_name: menu_option_back_name
|
523
555
|
:procname: val_as_str
|
556
|
+
- :default:
|
557
|
+
:line: "* Edit"
|
558
|
+
:description: Text for Edit option
|
559
|
+
:env_var: MDE_MENU_OPTION_EDIT_NAME
|
560
|
+
:opt_name: menu_option_edit_name
|
561
|
+
:procname: val_as_str
|
524
562
|
- :default:
|
525
563
|
:line: "* Exit"
|
526
564
|
:description: Text for Exit option
|
527
565
|
:env_var: MDE_MENU_OPTION_EXIT_NAME
|
528
566
|
:opt_name: menu_option_exit_name
|
529
567
|
:procname: val_as_str
|
568
|
+
- :default:
|
569
|
+
:line: "* Load"
|
570
|
+
:description: Text for Load option
|
571
|
+
:env_var: MDE_MENU_OPTION_LOAD_NAME
|
572
|
+
:opt_name: menu_option_load_name
|
573
|
+
:procname: val_as_str
|
574
|
+
- :default:
|
575
|
+
:line: "* Save"
|
576
|
+
:description: Text for Save option
|
577
|
+
:env_var: MDE_MENU_OPTION_SAVE_NAME
|
578
|
+
:opt_name: menu_option_save_name
|
579
|
+
:procname: val_as_str
|
580
|
+
- :default:
|
581
|
+
:line: "! Shell"
|
582
|
+
:description: Text for Shell option
|
583
|
+
:env_var: MDE_MENU_OPTION_SHELL_NAME
|
584
|
+
:opt_name: menu_option_shell_name
|
585
|
+
:procname: val_as_str
|
586
|
+
- :default:
|
587
|
+
:line: "* View"
|
588
|
+
:description: Text for View option
|
589
|
+
:env_var: MDE_MENU_OPTION_VIEW_NAME
|
590
|
+
:opt_name: menu_option_view_name
|
591
|
+
:procname: val_as_str
|
530
592
|
- :default: fg_rgbh_ff_00_ff
|
531
593
|
:description: Color of menu opts
|
532
594
|
:env_var: MDE_MENU_OPTS_COLOR
|
@@ -595,11 +657,17 @@
|
|
595
657
|
:opt_name: menu_with_exit
|
596
658
|
:procname: val_as_bool
|
597
659
|
- :arg_name: BOOL
|
598
|
-
:default:
|
660
|
+
:default: false
|
599
661
|
:description: Display inherited lines in menu
|
600
662
|
:env_var: MDE_MENU_WITH_INHERITED_LINES
|
601
663
|
:opt_name: menu_with_inherited_lines
|
602
664
|
:procname: val_as_bool
|
665
|
+
- :arg_name: BOOL
|
666
|
+
:default: true
|
667
|
+
:description: Display Shell option in menu
|
668
|
+
:env_var: MDE_MENU_WITH_SHELL
|
669
|
+
:opt_name: menu_with_shell
|
670
|
+
:procname: val_as_bool
|
603
671
|
- :arg_name: BOOL
|
604
672
|
:default: false
|
605
673
|
:description: Hide decorative menu entries
|
@@ -636,7 +704,6 @@
|
|
636
704
|
:default: false
|
637
705
|
:description: Display summary for execution
|
638
706
|
:env_var: MDE_OUTPUT_EXECUTION_SUMMARY
|
639
|
-
:long_name: output-execution-summary
|
640
707
|
:opt_name: output_execution_summary
|
641
708
|
:procname: val_as_bool
|
642
709
|
- :default: "%{name}: %{value}"
|
@@ -688,7 +755,7 @@
|
|
688
755
|
:short_name: p
|
689
756
|
- :arg_name: BOOL
|
690
757
|
:default: false
|
691
|
-
:description:
|
758
|
+
:description: Whether to pause after manually executing a block and the next menu
|
692
759
|
:env_var: MDE_PAUSE_AFTER_SCRIPT_EXECUTION
|
693
760
|
:opt_name: pause_after_script_execution
|
694
761
|
:procname: val_as_bool
|
@@ -728,6 +795,11 @@
|
|
728
795
|
:env_var: MDE_PROMPT_EXIT
|
729
796
|
:opt_name: prompt_exit
|
730
797
|
:procname: val_as_str
|
798
|
+
- :default: Back
|
799
|
+
:description: Quit prompt
|
800
|
+
:env_var: MDE_PROMPT_FILESPEC_OTHER
|
801
|
+
:opt_name: prompt_filespec_back
|
802
|
+
:procname: val_as_str
|
731
803
|
- :default: Other
|
732
804
|
:description: Prompt for a custom file name
|
733
805
|
:env_var: MDE_PROMPT_FILESPEC_OTHER
|
@@ -809,14 +881,12 @@
|
|
809
881
|
:default: false
|
810
882
|
:description: Wheter to save an executed script`
|
811
883
|
:env_var: MDE_SAVE_EXECUTED_SCRIPT
|
812
|
-
:long_name: save-executed-script
|
813
884
|
:opt_name: save_executed_script
|
814
885
|
:procname: val_as_bool
|
815
886
|
- :arg_name: BOOL
|
816
887
|
:default: false
|
817
888
|
:description: Save standard output of the executed script
|
818
889
|
:env_var: MDE_SAVE_EXECUTION_OUTPUT
|
819
|
-
:long_name: save-execution-output
|
820
890
|
:opt_name: save_execution_output
|
821
891
|
:procname: val_as_bool
|
822
892
|
- :default: "/"
|
@@ -845,7 +915,6 @@
|
|
845
915
|
:default: logs
|
846
916
|
:description: Folder where saved scripts are stored
|
847
917
|
:env_var: MDE_SAVED_SCRIPT_FOLDER
|
848
|
-
:long_name: saved-script-folder
|
849
918
|
:opt_name: saved_script_folder
|
850
919
|
:procname: val_as_str
|
851
920
|
- :arg_name: GLOB
|
@@ -858,7 +927,6 @@
|
|
858
927
|
:default: logs
|
859
928
|
:description: Saved stdout folder
|
860
929
|
:env_var: MDE_SAVED_STDOUT_FOLDER
|
861
|
-
:long_name: saved-stdout-folder
|
862
930
|
:opt_name: saved_stdout_folder
|
863
931
|
:procname: val_as_str
|
864
932
|
- :arg_name: GLOB
|
data/lib/saved_assets.rb
CHANGED
@@ -12,7 +12,8 @@ module MarkdownExec
|
|
12
12
|
# method derives a name for stdout redirection.
|
13
13
|
#
|
14
14
|
class SavedAsset
|
15
|
-
FNR11 = %r{
|
15
|
+
FNR11 = %r{[^!#$%&()\+,\-0-9=A-Z_a-z~]}.freeze
|
16
|
+
# / !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
|
16
17
|
FNR12 = '_'
|
17
18
|
DEFAULT_FTIME = '%F-%H-%M-%S'
|
18
19
|
|
@@ -43,7 +44,7 @@ class SavedAssetTest < Minitest::Test
|
|
43
44
|
time = Time.new(2023, 1, 1, 12, 0, 0)
|
44
45
|
blockname = 'block/1:2'
|
45
46
|
|
46
|
-
expected_name = 'test_2023-01-01-12-00-
|
47
|
+
expected_name = 'test_2023-01-01-12-00-00_sample_txt_,_block_1_2.sh'
|
47
48
|
assert_equal expected_name, MarkdownExec::SavedAsset.script_name(
|
48
49
|
filename: filename, prefix: prefix, time: time, blockname: blockname
|
49
50
|
)
|
@@ -55,7 +56,7 @@ class SavedAssetTest < Minitest::Test
|
|
55
56
|
time = Time.new(2023, 1, 1, 12, 0, 0)
|
56
57
|
blockname = 'block/1:2'
|
57
58
|
|
58
|
-
expected_name = 'test_2023-01-01-12-00-
|
59
|
+
expected_name = 'test_2023-01-01-12-00-00_sample_txt_,_block_1_2.out.txt'
|
59
60
|
assert_equal expected_name, MarkdownExec::SavedAsset.stdout_name(
|
60
61
|
filename: filename, prefix: prefix, time: time, blockname: blockname
|
61
62
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_exec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fareed Stevenson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- bin/setup
|
114
114
|
- bin/tab_completion.sh
|
115
115
|
- bin/tab_completion.sh.erb
|
116
|
+
- examples/block_names.md
|
116
117
|
- examples/colors.md
|
117
118
|
- examples/document_options.md
|
118
119
|
- examples/duplicate_block.md
|
@@ -121,16 +122,21 @@ files:
|
|
121
122
|
- examples/include.md
|
122
123
|
- examples/indent.md
|
123
124
|
- examples/index.md
|
125
|
+
- examples/interrupt.md
|
126
|
+
- examples/line-wrapping.md
|
124
127
|
- examples/linked.md
|
125
128
|
- examples/linked1.md
|
126
129
|
- examples/linked2.md
|
127
130
|
- examples/linked3.md
|
131
|
+
- examples/linked_show.md
|
128
132
|
- examples/llm.md
|
129
133
|
- examples/load1.sh
|
130
134
|
- examples/load2.sh
|
135
|
+
- examples/load_code.md
|
131
136
|
- examples/nickname.md
|
132
137
|
- examples/opts.md
|
133
138
|
- examples/pass-through.md
|
139
|
+
- examples/pause-after-execution.md
|
134
140
|
- examples/plant.md
|
135
141
|
- examples/port.md
|
136
142
|
- examples/search.md
|
@@ -144,6 +150,7 @@ files:
|
|
144
150
|
- lib/cached_nested_file_reader.rb
|
145
151
|
- lib/ce_get_cost_and_usage.rb
|
146
152
|
- lib/cli.rb
|
153
|
+
- lib/color_scheme.rb
|
147
154
|
- lib/colorize.rb
|
148
155
|
- lib/constants.rb
|
149
156
|
- lib/directory_searcher.rb
|