markdown_exec 1.8.7 → 1.8.8
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +33 -3
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -1
- data/Rakefile +1 -0
- data/bin/bmde +1 -1
- data/bin/tab_completion.sh +4 -4
- data/examples/colors.md +2 -1
- data/examples/indent.md +66 -0
- data/examples/linked.md +20 -1
- data/examples/load1.sh +5 -0
- data/examples/load2.sh +5 -0
- data/examples/nickname.md +26 -0
- data/lib/array.rb +4 -0
- data/lib/cached_nested_file_reader.rb +47 -43
- data/lib/ce_get_cost_and_usage.rb +22 -0
- data/lib/constants.rb +7 -0
- data/lib/exceptions.rb +6 -4
- data/lib/fcb.rb +5 -2
- data/lib/filter.rb +6 -8
- data/lib/find_files.rb +99 -0
- data/lib/hash_delegator.rb +1001 -768
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/mdoc.rb +27 -28
- data/lib/menu.src.yml +129 -17
- data/lib/menu.yml +94 -7
- metadata +8 -6
- data/lib/method_sorter.rb +0 -78
- data/lib/pty1.rb +0 -26
- data/lib/regexp_replacer.rb +0 -58
- data/lib/sort_yaml_gpt4.rb +0 -32
data/lib/mdoc.rb
CHANGED
@@ -76,15 +76,18 @@ module MarkdownExec
|
|
76
76
|
raise "Named code block `#{name}` not found. (@#{__LINE__})"
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
nickname = name_block[:nickname] || name_block[:oname]
|
80
|
+
dependencies = collect_dependencies(nickname)
|
80
81
|
# &bc 'dependencies.count:',dependencies.count
|
81
|
-
all_dependency_names = collect_unique_names(dependencies).push(
|
82
|
+
all_dependency_names = collect_unique_names(dependencies).push(nickname).uniq
|
82
83
|
# &bc 'all_dependency_names.count:',all_dependency_names.count
|
83
84
|
|
84
85
|
# select non-chrome blocks in order of appearance in source documents
|
85
86
|
#
|
86
87
|
blocks = @table.select do |fcb|
|
87
|
-
!fcb.fetch(:chrome,
|
88
|
+
!fcb.fetch(:chrome,
|
89
|
+
false) && all_dependency_names.include?(fcb.fetch(:nickname,
|
90
|
+
nil) || fcb.fetch(:oname))
|
88
91
|
end
|
89
92
|
# &bc 'blocks.count:',blocks.count
|
90
93
|
|
@@ -92,9 +95,9 @@ module MarkdownExec
|
|
92
95
|
#
|
93
96
|
unmet_dependencies = all_dependency_names.dup
|
94
97
|
blocks = blocks.map do |fcb|
|
95
|
-
unmet_dependencies.delete(fcb[:oname]) # may not exist if block name is duplicated
|
98
|
+
unmet_dependencies.delete(fcb[:nickname] || fcb[:oname]) # may not exist if block name is duplicated
|
96
99
|
if (call = fcb[:call])
|
97
|
-
[
|
100
|
+
[get_block_by_anyname("[#{call.match(/^%\((\S+) |\)/)[1]}]")
|
98
101
|
.merge({ cann: call })]
|
99
102
|
else
|
100
103
|
[]
|
@@ -121,7 +124,7 @@ module MarkdownExec
|
|
121
124
|
# &bc 'blocks.count:',blocks.count
|
122
125
|
|
123
126
|
block_search.merge(
|
124
|
-
{ block_names: blocks.map { |block| block[:oname] },
|
127
|
+
{ block_names: blocks.map { |block| block[:nickname] || block[:oname] },
|
125
128
|
code: blocks.map do |fcb|
|
126
129
|
if fcb[:cann]
|
127
130
|
collect_block_code_cann(fcb)
|
@@ -133,11 +136,12 @@ module MarkdownExec
|
|
133
136
|
elsif fcb[:shell] == BlockType::PORT
|
134
137
|
collect_block_code_shell(fcb)
|
135
138
|
elsif label_body
|
139
|
+
block_name_for_bash_comment = (fcb[:nickname] || fcb[:oname]).gsub(/\s+/, '_')
|
136
140
|
[label_format_above && format(label_format_above,
|
137
|
-
block_source.merge({ block_name:
|
141
|
+
block_source.merge({ block_name: block_name_for_bash_comment }))] +
|
138
142
|
fcb[:body] +
|
139
143
|
[label_format_below && format(label_format_below,
|
140
|
-
block_source.merge({ block_name:
|
144
|
+
block_source.merge({ block_name: block_name_for_bash_comment }))]
|
141
145
|
else # raw body
|
142
146
|
fcb[:body]
|
143
147
|
end
|
@@ -194,9 +198,15 @@ module MarkdownExec
|
|
194
198
|
|
195
199
|
### hide rows correctly
|
196
200
|
|
201
|
+
if !options[:menu_include_imported_blocks]
|
202
|
+
selrows = selrows.reject do |block|
|
203
|
+
block.fetch(:depth, 0).positive?
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
197
207
|
if opts[:hide_blocks_by_name]
|
198
208
|
selrows = selrows.reject do |block|
|
199
|
-
|
209
|
+
hide_menu_block_on_name opts, block
|
200
210
|
end
|
201
211
|
end
|
202
212
|
|
@@ -216,19 +226,8 @@ module MarkdownExec
|
|
216
226
|
#
|
217
227
|
def get_block_by_anyname(name, default = {})
|
218
228
|
@table.select do |fcb|
|
219
|
-
fcb.fetch(:
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
def get_block_by_dname(name, default = {})
|
224
|
-
@table.select do |fcb|
|
225
|
-
fcb.fetch(:dname, '') == name
|
226
|
-
end.fetch(0, default)
|
227
|
-
end
|
228
|
-
|
229
|
-
def get_block_by_oname(name, default = {})
|
230
|
-
@table.select do |fcb|
|
231
|
-
fcb.fetch(:oname, '') == name
|
229
|
+
fcb.fetch(:nickname,
|
230
|
+
'') == name || fcb.fetch(:dname, '') == name || fcb.fetch(:oname, '') == name
|
232
231
|
end.fetch(0, default)
|
233
232
|
end
|
234
233
|
|
@@ -239,7 +238,7 @@ module MarkdownExec
|
|
239
238
|
# @return [Boolean] True if the code block should be hidden; false otherwise.
|
240
239
|
#
|
241
240
|
# :reek:UtilityFunction
|
242
|
-
def
|
241
|
+
def hide_menu_block_on_name(opts, block)
|
243
242
|
if block.fetch(:chrome, false)
|
244
243
|
false
|
245
244
|
else
|
@@ -270,7 +269,7 @@ module MarkdownExec
|
|
270
269
|
next if memo.include? req
|
271
270
|
|
272
271
|
memo += [req]
|
273
|
-
|
272
|
+
get_block_by_anyname(req).fetch(:reqs, [])
|
274
273
|
end
|
275
274
|
.compact
|
276
275
|
.flatten(1)
|
@@ -445,10 +444,10 @@ if $PROGRAM_NAME == __FILE__
|
|
445
444
|
# end
|
446
445
|
|
447
446
|
def test_get_block_by_name
|
448
|
-
result = @doc.
|
447
|
+
result = @doc.get_block_by_anyname('block1')
|
449
448
|
assert_equal @table[0], result
|
450
449
|
|
451
|
-
result_missing = @doc.
|
450
|
+
result_missing = @doc.get_block_by_anyname('missing_block')
|
452
451
|
assert_equal({}, result_missing)
|
453
452
|
end
|
454
453
|
|
@@ -463,11 +462,11 @@ if $PROGRAM_NAME == __FILE__
|
|
463
462
|
end
|
464
463
|
end
|
465
464
|
|
466
|
-
def
|
465
|
+
def test_hide_menu_block_on_name
|
467
466
|
opts = { hide_blocks_by_name: true,
|
468
467
|
block_name_hidden_match: 'block1' }
|
469
468
|
block = FCB.new(oname: 'block1')
|
470
|
-
result = @doc.
|
469
|
+
result = @doc.hide_menu_block_on_name(opts, block)
|
471
470
|
assert result # this should be true based on the given logic
|
472
471
|
end
|
473
472
|
|
data/lib/menu.src.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
---
|
2
2
|
- :description: Show current configuration values
|
3
3
|
:procname: show_config
|
4
|
-
:short_name:
|
4
|
+
:short_name: '0'
|
5
5
|
|
6
6
|
- :arg_name: BOOL
|
7
|
-
:default:
|
7
|
+
:default: true
|
8
8
|
:description: Display only blocks of type "bash"
|
9
9
|
:env_var: MDE_BASH_ONLY
|
10
10
|
:opt_name: bash_only
|
@@ -30,7 +30,7 @@
|
|
30
30
|
:opt_name: block_name_hidden_match
|
31
31
|
:procname: val_as_str
|
32
32
|
|
33
|
-
- :default: "
|
33
|
+
- :default: "^\\(.*\\)$"
|
34
34
|
:description: Pattern for blocks to hide from user-selection
|
35
35
|
:env_var: MDE_BLOCK_NAME_INCLUDE_MATCH
|
36
36
|
:opt_name: block_name_include_match
|
@@ -41,6 +41,12 @@
|
|
41
41
|
:opt_name: block_name_match
|
42
42
|
:procname: val_as_str
|
43
43
|
|
44
|
+
- :default: "^\\[.*\\]$"
|
45
|
+
:description: Pattern for block nicknames (name is not used in menu)
|
46
|
+
:env_var: MDE_BLOCK_NAME_NICK_MATCH
|
47
|
+
:opt_name: block_name_nick_match
|
48
|
+
:procname: val_as_str
|
49
|
+
|
44
50
|
- :default: "^{.+}$"
|
45
51
|
:description: Pattern for block names to use as wrappers
|
46
52
|
:env_var: MDE_BLOCK_NAME_WRAPPER_MATCH
|
@@ -73,6 +79,13 @@
|
|
73
79
|
:long_name: config
|
74
80
|
:procname: path
|
75
81
|
|
82
|
+
- :arg_name: BOOL
|
83
|
+
:default: true
|
84
|
+
:description: debounce_execution
|
85
|
+
:env_var: MDE_debounce_execution
|
86
|
+
:opt_name: debounce_execution
|
87
|
+
:procname: val_as_bool
|
88
|
+
|
76
89
|
- :arg_name: BOOL
|
77
90
|
:default: false
|
78
91
|
:description: Debug output
|
@@ -177,6 +190,68 @@
|
|
177
190
|
:opt_name: exclude_expect_blocks
|
178
191
|
:procname: val_as_bool
|
179
192
|
|
193
|
+
- :default: >
|
194
|
+
osascript -e '
|
195
|
+
tell application "iTerm"
|
196
|
+
tell application "System Events"
|
197
|
+
tell application "Finder"
|
198
|
+
set {posx, posy, screenWidth, screenHeight} to bounds of window of desktop
|
199
|
+
end tell
|
200
|
+
tell application process "Finder"
|
201
|
+
set {missing value, menubarHeight} to the size of menu bar 1
|
202
|
+
end tell
|
203
|
+
end tell
|
204
|
+
|
205
|
+
set winHeight to (screenHeight * 2 / 3)
|
206
|
+
set winWidth to (screenWidth / 2)
|
207
|
+
set xoff to menubarHeight * %{batch_index}
|
208
|
+
set yoff to xoff mod (screenHeight - winHeight)
|
209
|
+
|
210
|
+
create window with default profile
|
211
|
+
tell the first window
|
212
|
+
set bounds to {xoff, yoff, xoff + winWidth, yoff + winHeight}
|
213
|
+
tell the current session
|
214
|
+
write text "alias cat_script=\"cat -n \\\"%{script_filespec}\\\"\""
|
215
|
+
write text "alias less_script=\"less \\\"%{script_filespec}\\\"\""
|
216
|
+
write text "alias run_script=\"%{script_filespec}\""
|
217
|
+
write text "alias vim_script=\"vim \\\"%{script_filespec}\\\"\""
|
218
|
+
delay 1
|
219
|
+
|
220
|
+
write text "alias cat_output=\"cat -n \\\"%{output_filespec}\\\"\""
|
221
|
+
write text "alias grep_output=\"read -p Pattern: pattern && grep \\\"\\$pattern\\\" \\\"%{output_filespec}\\\"\""
|
222
|
+
write text "alias less_output=\"less \\\"%{output_filespec}\\\"\""
|
223
|
+
delay 1
|
224
|
+
|
225
|
+
write text "alias menu=\"select cmd in cat_script less_script run_script vim_script cat_output grep_output less_output exit; do eval \\\"\\$cmd\\\"; done\""
|
226
|
+
delay 1
|
227
|
+
|
228
|
+
write text "echo -ne \"\\033]; %{started_at} - %{document_filename} - %{block_name} \\007\""
|
229
|
+
write text "cd \"%{home}\""
|
230
|
+
write text "\"%{script_filename}\" | tee \"%{output_filespec}\""
|
231
|
+
delay 2
|
232
|
+
|
233
|
+
write text "menu"
|
234
|
+
end tell
|
235
|
+
end tell
|
236
|
+
end tell'
|
237
|
+
:description: execute_command_format
|
238
|
+
:env_var: MDE_EXECUTE_COMMAND_FORMAT
|
239
|
+
:opt_name: execute_command_format
|
240
|
+
:procname: val_as_str
|
241
|
+
|
242
|
+
- :default: "%T"
|
243
|
+
:description: Format for time in window title
|
244
|
+
:env_var: MDE_EXECUTE_COMMAND_TITLE_TIME_FORMAT
|
245
|
+
:opt_name: execute_command_title_time_format
|
246
|
+
:procname: val_as_str
|
247
|
+
|
248
|
+
- :arg_name: BOOL
|
249
|
+
:default: true
|
250
|
+
:description: Execute script in own window
|
251
|
+
:env_var: MDE_EXECUTE_IN_OWN_WINDOW
|
252
|
+
:opt_name: execute_in_own_window
|
253
|
+
:procname: val_as_bool
|
254
|
+
|
180
255
|
- :default: fg_rgbh_7f_ff_00
|
181
256
|
:description: execution_report_preview_frame_color
|
182
257
|
:env_var: MDE_EXECUTION_REPORT_PREVIEW_FRAME_COLOR
|
@@ -224,14 +299,14 @@
|
|
224
299
|
:short_name: f
|
225
300
|
|
226
301
|
- :arg_name: FIND
|
227
|
-
:default:
|
302
|
+
:default: ''
|
228
303
|
:description: Find in documents
|
229
304
|
:long_name: find
|
230
305
|
:procname: find
|
231
306
|
:short_name: "?"
|
232
307
|
|
233
308
|
- :arg_name: FIND_PATH
|
234
|
-
:default:
|
309
|
+
:default: ''
|
235
310
|
:description: Path for find (uses PATH if empty)
|
236
311
|
:env_var: MDE_FIND_PATH
|
237
312
|
:long_name: find-path
|
@@ -278,12 +353,17 @@
|
|
278
353
|
:procname: val_as_str
|
279
354
|
|
280
355
|
- :arg_name: HOW
|
281
|
-
:default:
|
356
|
+
:default: ''
|
282
357
|
:description: Find in YAML configuration options
|
283
358
|
:long_name: how
|
284
359
|
:procname: how
|
285
360
|
:short_name: "?"
|
286
361
|
|
362
|
+
- :default:
|
363
|
+
:env_var: MDE_IMPORT_PATHS
|
364
|
+
:opt_name: import_paths
|
365
|
+
:procname: val_as_str
|
366
|
+
|
287
367
|
- :default: "^ *@import +(?<name>.+?) *$"
|
288
368
|
:env_var: MDE_IMPORT_PATTERN
|
289
369
|
:opt_name: import_pattern
|
@@ -455,7 +535,7 @@
|
|
455
535
|
:opt_name: menu_heading3_format
|
456
536
|
:procname: val_as_str
|
457
537
|
|
458
|
-
- :default:
|
538
|
+
- :default: '0'
|
459
539
|
:description: Import levels for blocks to appear in menu. Empty is all.
|
460
540
|
:env_var: MDE_MENU_IMPORT_LEVEL_MATCH
|
461
541
|
:opt_name: menu_import_level_match
|
@@ -496,7 +576,7 @@
|
|
496
576
|
:procname: val_as_str
|
497
577
|
|
498
578
|
- :default:
|
499
|
-
:line:
|
579
|
+
:line: ''
|
500
580
|
:description: opening demarcation for menu
|
501
581
|
:env_var: MDE_MENU_INITIAL_DIVIDER
|
502
582
|
:opt_name: menu_initial_divider
|
@@ -642,6 +722,26 @@
|
|
642
722
|
:opt_name: no_chrome
|
643
723
|
:procname: val_as_bool
|
644
724
|
|
725
|
+
- :default:
|
726
|
+
:description: Expression to match to start collecting lines
|
727
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_BEGIN
|
728
|
+
:opt_name: output_assignment_begin
|
729
|
+
:procname: val_as_str
|
730
|
+
- :default:
|
731
|
+
:description: Expression to match to stop collecting lines
|
732
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_END
|
733
|
+
:opt_name: output_assignment_begin
|
734
|
+
:procname: val_as_str
|
735
|
+
- :default: "%{line} # !!!"
|
736
|
+
:description: Format for assignments from output
|
737
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
|
738
|
+
:opt_name: output_assignment_format
|
739
|
+
:procname: val_as_str
|
740
|
+
- :default: "^ *(\\w+=.*?) *$"
|
741
|
+
:description: Pattern for assignments from output
|
742
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_MATCH
|
743
|
+
:opt_name: output_assignment_match
|
744
|
+
:procname: val_as_str
|
645
745
|
- :arg_name: BOOL
|
646
746
|
:default: false
|
647
747
|
:description: Display summary for execution
|
@@ -706,7 +806,7 @@
|
|
706
806
|
:short_name: p
|
707
807
|
|
708
808
|
- :arg_name: BOOL
|
709
|
-
:default:
|
809
|
+
:default: false
|
710
810
|
:description: Wheter to pause after manually executing a block and the next menu
|
711
811
|
:env_var: MDE_PAUSE_AFTER_SCRIPT_EXECUTION
|
712
812
|
:opt_name: pause_after_script_execution
|
@@ -730,13 +830,19 @@
|
|
730
830
|
:opt_name: prompt_color_after_script_execution
|
731
831
|
:procname: val_as_str
|
732
832
|
|
833
|
+
- :default: "\nRepeat this block?"
|
834
|
+
:description: Prompt to debounce
|
835
|
+
:env_var: MDE_PROMPT_DEBOUNCE
|
836
|
+
:opt_name: prompt_debounce
|
837
|
+
:procname: val_as_str
|
838
|
+
|
733
839
|
- :default: Exit
|
734
840
|
:description: Prompt to exit app
|
735
841
|
:env_var: MDE_PROMPT_EXIT
|
736
842
|
:opt_name: prompt_exit
|
737
843
|
:procname: val_as_str
|
738
844
|
|
739
|
-
- :default:
|
845
|
+
- :default: 'No'
|
740
846
|
:description: Prompt for no
|
741
847
|
:env_var: MDE_PROMPT_NO
|
742
848
|
:opt_name: prompt_no
|
@@ -772,7 +878,13 @@
|
|
772
878
|
:opt_name: prompt_select_output
|
773
879
|
:procname: val_as_str
|
774
880
|
|
775
|
-
- :default:
|
881
|
+
- :default: Uninterrupted
|
882
|
+
:description: Uninterrupted execution
|
883
|
+
:env_var: MDE_PROMPT_UNINTERRUPTED
|
884
|
+
:opt_name: prompt_uninterrupted
|
885
|
+
:procname: val_as_str
|
886
|
+
|
887
|
+
- :default: 'Yes'
|
776
888
|
:description: Prompt for yes
|
777
889
|
:env_var: MDE_PROMPT_YES
|
778
890
|
:opt_name: prompt_yes
|
@@ -789,7 +901,7 @@
|
|
789
901
|
:procname: val_as_bool
|
790
902
|
|
791
903
|
- :default: 1
|
792
|
-
:description:
|
904
|
+
:description: Runtime exception error level (warn if < 0, ignore if 0, abort if > 0)
|
793
905
|
:env_var: MDE_RUNTIME_EXCEPTION_ERROR_LEVEL
|
794
906
|
:opt_name: runtime_exception_error_level
|
795
907
|
:procname: val_as_int
|
@@ -917,7 +1029,7 @@
|
|
917
1029
|
:procname: val_as_str
|
918
1030
|
|
919
1031
|
- :default: 36
|
920
|
-
:description:
|
1032
|
+
:description: 'Maximum # of rows in select list'
|
921
1033
|
:env_var: MDE_SELECT_PAGE_HEIGHT
|
922
1034
|
:opt_name: select_page_height
|
923
1035
|
:procname: val_as_int
|
@@ -944,13 +1056,13 @@
|
|
944
1056
|
:opt_name: shell
|
945
1057
|
:procname: val_as_str
|
946
1058
|
|
947
|
-
- :default: "# -^-
|
1059
|
+
- :default: "# -^-"
|
948
1060
|
:description: shell_code_label_format_above
|
949
1061
|
:env_var: MDE_SHELL_CODE_LABEL_FORMAT_ABOVE
|
950
1062
|
:opt_name: shell_code_label_format_above
|
951
1063
|
:procname: val_as_str
|
952
1064
|
|
953
|
-
- :default: "# -v- +%{block_name} -v-"
|
1065
|
+
- :default: "# -v- +%{block_name} -o- %{document_filename} -v-"
|
954
1066
|
:description: shell_code_label_format_below
|
955
1067
|
:env_var: MDE_SHELL_CODE_LABEL_FORMAT_BELOW
|
956
1068
|
:opt_name: shell_code_label_format_below
|
@@ -962,7 +1074,7 @@
|
|
962
1074
|
:procname: val_as_bool
|
963
1075
|
|
964
1076
|
- :arg_name: BOOL
|
965
|
-
:default:
|
1077
|
+
:default: false
|
966
1078
|
:description: Requires user approval before executing a script
|
967
1079
|
:env_var: MDE_USER_MUST_APPROVE
|
968
1080
|
:long_name: user-must-approve
|
@@ -981,7 +1093,7 @@
|
|
981
1093
|
:opt_name: warning_color
|
982
1094
|
:procname: val_as_str
|
983
1095
|
|
984
|
-
- :default:
|
1096
|
+
- :default: 'Error: %{error}'
|
985
1097
|
:description: Format of warning message
|
986
1098
|
:env_var: MDE_WARNING_FORMAT
|
987
1099
|
:opt_name: warning_format
|
data/lib/menu.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# MDE - Markdown Executor (1.8.
|
1
|
+
# MDE - Markdown Executor (1.8.8)
|
2
2
|
---
|
3
3
|
- :description: Show current configuration values
|
4
4
|
:procname: show_config
|
5
5
|
:short_name: '0'
|
6
6
|
- :arg_name: BOOL
|
7
|
-
:default:
|
7
|
+
:default: true
|
8
8
|
:description: Display only blocks of type "bash"
|
9
9
|
:env_var: MDE_BASH_ONLY
|
10
10
|
:opt_name: bash_only
|
@@ -26,7 +26,7 @@
|
|
26
26
|
:env_var: MDE_BLOCK_NAME_HIDDEN_MATCH
|
27
27
|
:opt_name: block_name_hidden_match
|
28
28
|
:procname: val_as_str
|
29
|
-
- :default: "
|
29
|
+
- :default: "^\\(.*\\)$"
|
30
30
|
:description: Pattern for blocks to hide from user-selection
|
31
31
|
:env_var: MDE_BLOCK_NAME_INCLUDE_MATCH
|
32
32
|
:opt_name: block_name_include_match
|
@@ -35,6 +35,11 @@
|
|
35
35
|
:env_var: MDE_BLOCK_NAME_MATCH
|
36
36
|
:opt_name: block_name_match
|
37
37
|
:procname: val_as_str
|
38
|
+
- :default: "^\\[.*\\]$"
|
39
|
+
:description: Pattern for block nicknames (name is not used in menu)
|
40
|
+
:env_var: MDE_BLOCK_NAME_NICK_MATCH
|
41
|
+
:opt_name: block_name_nick_match
|
42
|
+
:procname: val_as_str
|
38
43
|
- :default: "^{.+}$"
|
39
44
|
:description: Pattern for block names to use as wrappers
|
40
45
|
:env_var: MDE_BLOCK_NAME_WRAPPER_MATCH
|
@@ -61,6 +66,12 @@
|
|
61
66
|
:description: Read configuration file
|
62
67
|
:long_name: config
|
63
68
|
:procname: path
|
69
|
+
- :arg_name: BOOL
|
70
|
+
:default: true
|
71
|
+
:description: debounce_execution
|
72
|
+
:env_var: MDE_debounce_execution
|
73
|
+
:opt_name: debounce_execution
|
74
|
+
:procname: val_as_bool
|
64
75
|
- :arg_name: BOOL
|
65
76
|
:default: false
|
66
77
|
:description: Debug output
|
@@ -152,6 +163,46 @@
|
|
152
163
|
:env_var: MDE_EXCLUDE_EXPECT_BLOCKS
|
153
164
|
:opt_name: exclude_expect_blocks
|
154
165
|
:procname: val_as_bool
|
166
|
+
- :default: "osascript -e '\n tell application \"iTerm\"\n tell application
|
167
|
+
\"System Events\"\n tell application \"Finder\"\n set
|
168
|
+
{posx, posy, screenWidth, screenHeight} to bounds of window of desktop\n end
|
169
|
+
tell\n tell application process \"Finder\"\n set {missing
|
170
|
+
value, menubarHeight} to the size of menu bar 1\n end tell\n end
|
171
|
+
tell\n\n set winHeight to (screenHeight * 2 / 3)\n set winWidth
|
172
|
+
to (screenWidth / 2)\n set xoff to menubarHeight * %{batch_index}\n set
|
173
|
+
yoff to xoff mod (screenHeight - winHeight)\n \n create window with
|
174
|
+
default profile\n tell the first window\n set bounds to {xoff,
|
175
|
+
yoff, xoff + winWidth, yoff + winHeight}\n tell the current session\n
|
176
|
+
\ write text \"alias cat_script=\\\"cat -n \\\\\\\"%{script_filespec}\\\\\\\"\\\"\"\n
|
177
|
+
\ write text \"alias less_script=\\\"less \\\\\\\"%{script_filespec}\\\\\\\"\\\"\"\n
|
178
|
+
\ write text \"alias run_script=\\\"%{script_filespec}\\\"\"\n write
|
179
|
+
text \"alias vim_script=\\\"vim \\\\\\\"%{script_filespec}\\\\\\\"\\\"\"\n delay
|
180
|
+
1\n\n write text \"alias cat_output=\\\"cat -n \\\\\\\"%{output_filespec}\\\\\\\"\\\"\"\n
|
181
|
+
\ write text \"alias grep_output=\\\"read -p Pattern: pattern &&
|
182
|
+
grep \\\\\\\"\\\\$pattern\\\\\\\" \\\\\\\"%{output_filespec}\\\\\\\"\\\"\"\n write
|
183
|
+
text \"alias less_output=\\\"less \\\\\\\"%{output_filespec}\\\\\\\"\\\"\"\n delay
|
184
|
+
1\n\n write text \"alias menu=\\\"select cmd in cat_script less_script
|
185
|
+
run_script vim_script cat_output grep_output less_output exit; do eval \\\\\\\"\\\\$cmd\\\\\\\";
|
186
|
+
done\\\"\"\n delay 1\n\n write text \"echo -ne \\\"\\\\033];
|
187
|
+
%{started_at} - %{document_filename} - %{block_name} \\\\007\\\"\"\n write
|
188
|
+
text \"cd \\\"%{home}\\\"\"\n write text \"\\\"%{script_filename}\\\"
|
189
|
+
| tee \\\"%{output_filespec}\\\"\"\n delay 2\n\n write
|
190
|
+
text \"menu\"\n end tell\n end tell\n end tell'\n"
|
191
|
+
:description: execute_command_format
|
192
|
+
:env_var: MDE_EXECUTE_COMMAND_FORMAT
|
193
|
+
:opt_name: execute_command_format
|
194
|
+
:procname: val_as_str
|
195
|
+
- :default: "%T"
|
196
|
+
:description: Format for time in window title
|
197
|
+
:env_var: MDE_EXECUTE_COMMAND_TITLE_TIME_FORMAT
|
198
|
+
:opt_name: execute_command_title_time_format
|
199
|
+
:procname: val_as_str
|
200
|
+
- :arg_name: BOOL
|
201
|
+
:default: true
|
202
|
+
:description: Execute script in own window
|
203
|
+
:env_var: MDE_EXECUTE_IN_OWN_WINDOW
|
204
|
+
:opt_name: execute_in_own_window
|
205
|
+
:procname: val_as_bool
|
155
206
|
- :default: fg_rgbh_7f_ff_00
|
156
207
|
:description: execution_report_preview_frame_color
|
157
208
|
:env_var: MDE_EXECUTION_REPORT_PREVIEW_FRAME_COLOR
|
@@ -243,6 +294,10 @@
|
|
243
294
|
:long_name: how
|
244
295
|
:procname: how
|
245
296
|
:short_name: "?"
|
297
|
+
- :default:
|
298
|
+
:env_var: MDE_IMPORT_PATHS
|
299
|
+
:opt_name: import_paths
|
300
|
+
:procname: val_as_str
|
246
301
|
- :default: "^ *@import +(?<name>.+?) *$"
|
247
302
|
:env_var: MDE_IMPORT_PATTERN
|
248
303
|
:opt_name: import_pattern
|
@@ -541,6 +596,26 @@
|
|
541
596
|
:env_var: MDE_NO_CHROME
|
542
597
|
:opt_name: no_chrome
|
543
598
|
:procname: val_as_bool
|
599
|
+
- :default:
|
600
|
+
:description: Expression to match to start collecting lines
|
601
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_BEGIN
|
602
|
+
:opt_name: output_assignment_begin
|
603
|
+
:procname: val_as_str
|
604
|
+
- :default:
|
605
|
+
:description: Expression to match to stop collecting lines
|
606
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_END
|
607
|
+
:opt_name: output_assignment_begin
|
608
|
+
:procname: val_as_str
|
609
|
+
- :default: "%{line} # !!!"
|
610
|
+
:description: Format for assignments from output
|
611
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
|
612
|
+
:opt_name: output_assignment_format
|
613
|
+
:procname: val_as_str
|
614
|
+
- :default: "^ *(\\w+=.*?) *$"
|
615
|
+
:description: Pattern for assignments from output
|
616
|
+
:env_var: MDE_OUTPUT_ASSIGNMENT_MATCH
|
617
|
+
:opt_name: output_assignment_match
|
618
|
+
:procname: val_as_str
|
544
619
|
- :arg_name: BOOL
|
545
620
|
:default: false
|
546
621
|
:description: Display summary for execution
|
@@ -596,7 +671,7 @@
|
|
596
671
|
:procname: val_as_str
|
597
672
|
:short_name: p
|
598
673
|
- :arg_name: BOOL
|
599
|
-
:default:
|
674
|
+
:default: false
|
600
675
|
:description: Wheter to pause after manually executing a block and the next menu
|
601
676
|
:env_var: MDE_PAUSE_AFTER_SCRIPT_EXECUTION
|
602
677
|
:opt_name: pause_after_script_execution
|
@@ -620,6 +695,13 @@
|
|
620
695
|
:env_var: MDE_PROMPT_COLOR_AFTER_SCRIPT_EXECUTION
|
621
696
|
:opt_name: prompt_color_after_script_execution
|
622
697
|
:procname: val_as_str
|
698
|
+
- :default: |2-
|
699
|
+
|
700
|
+
Repeat this block?
|
701
|
+
:description: Prompt to debounce
|
702
|
+
:env_var: MDE_PROMPT_DEBOUNCE
|
703
|
+
:opt_name: prompt_debounce
|
704
|
+
:procname: val_as_str
|
623
705
|
- :default: Exit
|
624
706
|
:description: Prompt to exit app
|
625
707
|
:env_var: MDE_PROMPT_EXIT
|
@@ -661,6 +743,11 @@
|
|
661
743
|
:env_var: MDE_PROMPT_SELECT_OUTPUT
|
662
744
|
:opt_name: prompt_select_output
|
663
745
|
:procname: val_as_str
|
746
|
+
- :default: Uninterrupted
|
747
|
+
:description: Uninterrupted execution
|
748
|
+
:env_var: MDE_PROMPT_UNINTERRUPTED
|
749
|
+
:opt_name: prompt_uninterrupted
|
750
|
+
:procname: val_as_str
|
664
751
|
- :default: 'Yes'
|
665
752
|
:description: Prompt for yes
|
666
753
|
:env_var: MDE_PROMPT_YES
|
@@ -811,12 +898,12 @@
|
|
811
898
|
:env_var: MDE_SHELL
|
812
899
|
:opt_name: shell
|
813
900
|
:procname: val_as_str
|
814
|
-
- :default: "# -^-
|
901
|
+
- :default: "# -^-"
|
815
902
|
:description: shell_code_label_format_above
|
816
903
|
:env_var: MDE_SHELL_CODE_LABEL_FORMAT_ABOVE
|
817
904
|
:opt_name: shell_code_label_format_above
|
818
905
|
:procname: val_as_str
|
819
|
-
- :default: "# -v- +%{block_name} -v-"
|
906
|
+
- :default: "# -v- +%{block_name} -o- %{document_filename} -v-"
|
820
907
|
:description: shell_code_label_format_below
|
821
908
|
:env_var: MDE_SHELL_CODE_LABEL_FORMAT_BELOW
|
822
909
|
:opt_name: shell_code_label_format_below
|
@@ -826,7 +913,7 @@
|
|
826
913
|
:opt_name: tab_completions
|
827
914
|
:procname: val_as_bool
|
828
915
|
- :arg_name: BOOL
|
829
|
-
:default:
|
916
|
+
:default: false
|
830
917
|
:description: Requires user approval before executing a script
|
831
918
|
:env_var: MDE_USER_MUST_APPROVE
|
832
919
|
:long_name: user-must-approve
|
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: 1.8.
|
4
|
+
version: 1.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fareed Stevenson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -118,11 +118,15 @@ files:
|
|
118
118
|
- examples/import0.md
|
119
119
|
- examples/import1.md
|
120
120
|
- examples/include.md
|
121
|
+
- examples/indent.md
|
121
122
|
- examples/infile_config.md
|
122
123
|
- examples/linked.md
|
123
124
|
- examples/linked1.md
|
124
125
|
- examples/linked2.md
|
125
126
|
- examples/linked3.md
|
127
|
+
- examples/load1.sh
|
128
|
+
- examples/load2.sh
|
129
|
+
- examples/nickname.md
|
126
130
|
- examples/opts.md
|
127
131
|
- examples/pass-through.md
|
128
132
|
- examples/plant.md
|
@@ -135,6 +139,7 @@ files:
|
|
135
139
|
- lib/block_label.rb
|
136
140
|
- lib/block_types.rb
|
137
141
|
- lib/cached_nested_file_reader.rb
|
142
|
+
- lib/ce_get_cost_and_usage.rb
|
138
143
|
- lib/cli.rb
|
139
144
|
- lib/colorize.rb
|
140
145
|
- lib/constants.rb
|
@@ -143,6 +148,7 @@ files:
|
|
143
148
|
- lib/exceptions.rb
|
144
149
|
- lib/fcb.rb
|
145
150
|
- lib/filter.rb
|
151
|
+
- lib/find_files.rb
|
146
152
|
- lib/fout.rb
|
147
153
|
- lib/hash.rb
|
148
154
|
- lib/hash_delegator.rb
|
@@ -152,17 +158,13 @@ files:
|
|
152
158
|
- lib/mdoc.rb
|
153
159
|
- lib/menu.src.yml
|
154
160
|
- lib/menu.yml
|
155
|
-
- lib/method_sorter.rb
|
156
161
|
- lib/object_present.rb
|
157
162
|
- lib/option_value.rb
|
158
|
-
- lib/pty1.rb
|
159
163
|
- lib/regexp.rb
|
160
|
-
- lib/regexp_replacer.rb
|
161
164
|
- lib/rspec_helpers.rb
|
162
165
|
- lib/saved_assets.rb
|
163
166
|
- lib/saved_files_matcher.rb
|
164
167
|
- lib/shared.rb
|
165
|
-
- lib/sort_yaml_gpt4.rb
|
166
168
|
- lib/string_util.rb
|
167
169
|
- lib/tap.rb
|
168
170
|
homepage: https://rubygems.org/gems/markdown_exec
|