markdown_exec 1.8.8 → 1.8.9
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/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/bin/tab_completion.sh +2 -2
- data/examples/linked.md +71 -41
- data/lib/constants.rb +6 -1
- data/lib/hash_delegator.rb +66 -24
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/menu.src.yml +3 -18
- data/lib/menu.yml +6 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a81d96c57727583a17c019bcb0a8097c6d97633a7b5ee2b33e2d9a7e56a4c081
|
4
|
+
data.tar.gz: 4c67c34577546161914e77be928867128e55d926c3419c2ab4c6cc521d051cae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e7ffb35e3b7cf4aa9fa03095519d28aa088367a8b91cbcf440b143f732510a43401e78b435a0ea73f03a6754e55897fa9800b121f9f767d64715d4d79f019b3
|
7
|
+
data.tar.gz: a4f94c70dc8f58a7b6bf79a4baf063ef893173ccb26aa57f19a1ab485656ec469dcfa3f70555cb2bddddc55b8a3023576724d23dc30d2b16f444dbd732025b9f
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/bin/tab_completion.sh
CHANGED
@@ -13,7 +13,7 @@ __filedirs_all()
|
|
13
13
|
}
|
14
14
|
|
15
15
|
_mde_echo_version() {
|
16
|
-
echo "1.8.
|
16
|
+
echo "1.8.9"
|
17
17
|
}
|
18
18
|
|
19
19
|
_mde() {
|
@@ -178,4 +178,4 @@ _mde() {
|
|
178
178
|
|
179
179
|
complete -o filenames -o nospace -F _mde mde
|
180
180
|
# _mde_echo_version
|
181
|
-
# echo "Updated: 2024-01-
|
181
|
+
# echo "Updated: 2024-01-20 19:29:56 UTC"
|
data/examples/linked.md
CHANGED
@@ -1,62 +1,52 @@
|
|
1
|
-
Demonstrate setting
|
1
|
+
Demonstrate setting variable values interactively for use in generated scripts.
|
2
2
|
|
3
3
|
```opts :(document_options)
|
4
4
|
pause_after_script_execution: false
|
5
5
|
user_must_approve: false
|
6
6
|
```
|
7
7
|
|
8
|
-
::: Set
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
::: Set variable ALPHA in a Vars block
|
9
|
+
For each environment variable named in block,
|
10
|
+
append an inherited line that assigns the variable the specified value.
|
11
|
+
```vars :set_ALPHA_to_1_via_vars_block
|
12
|
+
ALPHA: 1
|
12
13
|
```
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
::: Set variable ALPHA in a Link block
|
16
|
+
For each environment variable in `vars`,
|
17
|
+
append an inherited line that assigns the variable the specified value.
|
18
|
+
Subsequently, run the `display_variable_ALPHA` block.
|
19
|
+
```link :set_ALPHA_to_2_via_link_block_and_display
|
20
|
+
block: display_variable_ALPHA
|
21
|
+
vars:
|
22
|
+
ALPHA: 2
|
16
23
|
```
|
17
24
|
|
18
|
-
|
19
|
-
block
|
20
|
-
|
25
|
+
Make the code in the required block `(bash_set_to_3)` into inherited lines.
|
26
|
+
Subsequently, run the `display_variable_ALPHA` block.
|
27
|
+
```bash :(bash_set_to_3)
|
28
|
+
ALPHA=3
|
21
29
|
```
|
22
|
-
|
23
|
-
|
24
|
-
echo VARIABLE=A
|
30
|
+
```link :set_ALPHA_to_3_via_required_block_and_display +(bash_set_to_3)
|
31
|
+
block: display_variable_ALPHA
|
25
32
|
```
|
26
33
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
```
|
32
|
-
|
33
|
-
```bash :(set_to_B)
|
34
|
-
VARIABLE=B
|
35
|
-
```
|
36
|
-
|
37
|
-
```link :set_to_B_eval +(set_to_B_eval)
|
38
|
-
block: display_variable
|
34
|
+
Evaluate the code in the required block `(bash_eval_set_to_4)` and
|
35
|
+
save (transformed) output into inherited lines.
|
36
|
+
Subsequently, run the `display_variable_ALPHA` block.
|
37
|
+
```link :set_ALPHA_to_4_via_evaluated_required_block_and_display +(bash_eval_set_to_4)
|
39
38
|
eval: true
|
39
|
+
next_block: display_variable_ALPHA
|
40
40
|
```
|
41
|
-
|
42
|
-
|
43
|
-
echo VARIABLE=B
|
41
|
+
```bash :(bash_eval_set_to_4)
|
42
|
+
echo 'ALPHA="4"'
|
44
43
|
```
|
45
44
|
|
46
|
-
::: Display value of
|
47
|
-
|
48
|
-
```bash :display_variable
|
45
|
+
::: Display value of ALPHA
|
46
|
+
```bash :display_variable_ALPHA
|
49
47
|
source bin/colorize_env_vars.sh
|
50
|
-
echo The current value of environment variable
|
51
|
-
colorize_env_vars ''
|
52
|
-
```
|
53
|
-
|
54
|
-
```bash :(set_timestamp)
|
55
|
-
echo 'yyyymmdd? (default: today UTC) '; read -r yyyymmdd; [[ -z $yyyymmdd ]] && yyyymmdd="$(date -u +%y%m%d)"
|
56
|
-
echo "EC2_STACK_TS='$yyyymmdd'"
|
57
|
-
```
|
58
|
-
```link :request_input_and_inherit_output +(set_timestamp)
|
59
|
-
exec: true
|
48
|
+
echo The current value of environment variable ALPHA is now:
|
49
|
+
colorize_env_vars '' ALPHA
|
60
50
|
```
|
61
51
|
|
62
52
|
::: Load file into inherited lines
|
@@ -69,3 +59,43 @@ Load, evaluate, and append output to inherited lines.
|
|
69
59
|
load: examples/load2.sh
|
70
60
|
eval: true
|
71
61
|
```
|
62
|
+
|
63
|
+
::: Save and Load
|
64
|
+
Save inherited lines to a file.
|
65
|
+
```link :save1
|
66
|
+
save: tmp/save1.sh
|
67
|
+
```
|
68
|
+
Load inherited lines from a file.
|
69
|
+
Subsequently, run the `display_variables` block.
|
70
|
+
```link :load_saved
|
71
|
+
load: tmp/save1.sh
|
72
|
+
block: display_variables
|
73
|
+
```
|
74
|
+
Display variables ALPHA, var1, var2
|
75
|
+
```bash :display_variables
|
76
|
+
source bin/colorize_env_vars.sh
|
77
|
+
colorize_env_vars '' ALPHA var1 var2
|
78
|
+
```
|
79
|
+
|
80
|
+
Execute a script requiring input from the user.
|
81
|
+
Save the output setting TIMESTAMP into inherited lines.
|
82
|
+
Subsequently, run the `display_TIMESTAMP` block.
|
83
|
+
```bash :(input_timestamp)
|
84
|
+
if [[ -z $TIMESTAMP ]]; then
|
85
|
+
default="$(date -u +%y%m%d)"
|
86
|
+
echo "yymmdd? (default: $default / today UTC) "
|
87
|
+
read -r TIMESTAMP
|
88
|
+
[[ -z $TIMESTAMP ]] && TIMESTAMP="$(date -u +%y%m%d)"
|
89
|
+
fi
|
90
|
+
```
|
91
|
+
```bash :(inherit_timestamp)
|
92
|
+
echo "TIMESTAMP=\"$TIMESTAMP\""
|
93
|
+
```
|
94
|
+
```link :set_timestamp +(input_timestamp) +(inherit_timestamp)
|
95
|
+
exec: true
|
96
|
+
block: display_TIMESTAMP
|
97
|
+
```
|
98
|
+
```bash :display_TIMESTAMP
|
99
|
+
source bin/colorize_env_vars.sh
|
100
|
+
colorize_env_vars '' TIMESTAMP
|
101
|
+
```
|
data/lib/constants.rb
CHANGED
@@ -17,11 +17,16 @@ IndexedLine = Struct.new(:index, :line) do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
class
|
20
|
+
class LinkKeys
|
21
|
+
Block = 'block'
|
21
22
|
Eval = 'eval'
|
22
23
|
Exec = 'exec'
|
24
|
+
File = 'file'
|
23
25
|
Load = 'load'
|
26
|
+
NextBlock = 'next_block'
|
24
27
|
Return = 'return'
|
28
|
+
Save = 'save'
|
29
|
+
Vars = 'vars'
|
25
30
|
end
|
26
31
|
|
27
32
|
class LoadFile
|
data/lib/hash_delegator.rb
CHANGED
@@ -185,16 +185,20 @@ module HashDelegatorSelf
|
|
185
185
|
fcb.oname = fcb.dname = fcb.title || ''
|
186
186
|
end
|
187
187
|
|
188
|
+
def join_code_lines(lines)
|
189
|
+
((lines || [])+ ['']).join("\n")
|
190
|
+
end
|
191
|
+
|
188
192
|
def merge_lists(*args)
|
189
193
|
# Filters out nil values, flattens the arrays, and ensures an empty list is returned if no valid lists are provided
|
190
194
|
merged = args.compact.flatten
|
191
195
|
merged.empty? ? [] : merged
|
192
196
|
end
|
193
197
|
|
194
|
-
def next_link_state(block_name_from_cli, was_using_cli, block_state)
|
198
|
+
def next_link_state(block_name_from_cli, was_using_cli, block_state, block_name: nil)
|
195
199
|
# &bsp 'next_link_state', block_name_from_cli, was_using_cli, block_state
|
196
200
|
# Set block_name based on block_name_from_cli
|
197
|
-
block_name = block_name_from_cli ? @cli_block_name :
|
201
|
+
block_name = block_name_from_cli ? @cli_block_name : block_name
|
198
202
|
# &bsp 'block_name:', block_name
|
199
203
|
|
200
204
|
# Determine the state of breaker based on was_using_cli and the block type
|
@@ -600,8 +604,6 @@ module MarkdownExec
|
|
600
604
|
# @param selected [Hash] The selected block.
|
601
605
|
# @return [Array<String>] Required code blocks as an array of lines.
|
602
606
|
def collect_required_code_lines(mdoc, selected, link_state = LinkState.new, block_source:)
|
603
|
-
set_environment_variables_for_block(selected) if selected[:shell] == BlockType::VARS
|
604
|
-
|
605
607
|
required = mdoc.collect_recursively_required_code(
|
606
608
|
selected[:nickname] || selected[:oname],
|
607
609
|
label_format_above: @delegate_object[:shell_code_label_format_above],
|
@@ -624,7 +626,9 @@ module MarkdownExec
|
|
624
626
|
highlight: [@delegate_object[:block_name]])
|
625
627
|
end
|
626
628
|
|
627
|
-
|
629
|
+
code_lines = selected[:shell] == BlockType::VARS ? set_environment_variables_for_block(selected) : []
|
630
|
+
|
631
|
+
HashDelegator.code_merge(link_state&.inherited_lines, required[:code] + code_lines)
|
628
632
|
end
|
629
633
|
|
630
634
|
def command_execute(command, args: [])
|
@@ -926,6 +930,22 @@ module MarkdownExec
|
|
926
930
|
@delegate_object.merge!(options_state.options)
|
927
931
|
options_state.load_file_link_state
|
928
932
|
|
933
|
+
elsif selected[:shell] == BlockType::VARS
|
934
|
+
debounce_reset
|
935
|
+
block_names = []
|
936
|
+
code_lines = set_environment_variables_for_block(selected)
|
937
|
+
dependencies = {}
|
938
|
+
link_history_push_and_next(
|
939
|
+
curr_block_name: selected[:oname],
|
940
|
+
curr_document_filename: @delegate_object[:filename],
|
941
|
+
inherited_block_names: ((link_state&.inherited_block_names || []) + block_names).sort.uniq,
|
942
|
+
inherited_dependencies: (link_state&.inherited_dependencies || {}).merge(dependencies || {}), ### merge, not replace, key data
|
943
|
+
inherited_lines: HashDelegator.code_merge(link_state&.inherited_lines, code_lines),
|
944
|
+
next_block_name: '',
|
945
|
+
next_document_filename: @delegate_object[:filename],
|
946
|
+
next_load_file: LoadFile::Reuse
|
947
|
+
)
|
948
|
+
|
929
949
|
elsif debounce_allows
|
930
950
|
compile_execute_and_trigger_reuse(mdoc, selected, link_state,
|
931
951
|
block_source: block_source)
|
@@ -1089,7 +1109,7 @@ module MarkdownExec
|
|
1089
1109
|
def link_block_data_eval(link_state, code_lines, selected, link_block_data)
|
1090
1110
|
all_code = HashDelegator.code_merge(link_state&.inherited_lines, code_lines)
|
1091
1111
|
|
1092
|
-
if link_block_data.fetch(
|
1112
|
+
if link_block_data.fetch(LinkKeys::Exec, false)
|
1093
1113
|
@run_state.files = Hash.new([])
|
1094
1114
|
output_lines = []
|
1095
1115
|
|
@@ -1338,7 +1358,7 @@ module MarkdownExec
|
|
1338
1358
|
inherited_block_names: ((link_state&.inherited_block_names || []) + block_names).sort.uniq,
|
1339
1359
|
inherited_dependencies: (link_state&.inherited_dependencies || {}).merge(dependencies || {}), ### merge, not replace, key data
|
1340
1360
|
inherited_lines: HashDelegator.code_merge(link_state&.inherited_lines, code_lines),
|
1341
|
-
next_block_name: '', # not link_block_data[
|
1361
|
+
next_block_name: '', # not link_block_data[LinkKeys::Block] || ''
|
1342
1362
|
next_document_filename: @delegate_object[:filename], # not next_document_filename
|
1343
1363
|
next_load_file: LoadFile::Reuse # not next_document_filename == @delegate_object[:filename] ? LoadFile::Reuse : LoadFile::Load
|
1344
1364
|
)
|
@@ -1539,13 +1559,6 @@ module MarkdownExec
|
|
1539
1559
|
link_state = LinkState.new)
|
1540
1560
|
link_block_data = HashDelegator.parse_yaml_data_from_body(link_block_body)
|
1541
1561
|
|
1542
|
-
# load key and values from link block into current environment
|
1543
|
-
#
|
1544
|
-
(link_block_data['vars'] || []).each do |(key, value)|
|
1545
|
-
ENV[key] = value.to_s
|
1546
|
-
### add to inherited_lines
|
1547
|
-
end
|
1548
|
-
|
1549
1562
|
## collect blocks specified by block
|
1550
1563
|
#
|
1551
1564
|
if mdoc
|
@@ -1563,22 +1576,40 @@ module MarkdownExec
|
|
1563
1576
|
code_lines = []
|
1564
1577
|
dependencies = {}
|
1565
1578
|
end
|
1566
|
-
next_document_filename = link_block_data[
|
1579
|
+
next_document_filename = link_block_data[LinkKeys::File] || @delegate_object[:filename]
|
1567
1580
|
|
1568
|
-
|
1581
|
+
# load key and values from link block into current environment
|
1569
1582
|
#
|
1570
|
-
if
|
1583
|
+
if link_block_data[LinkKeys::Vars]
|
1584
|
+
code_lines.push "# #{selected[:oname]}"
|
1585
|
+
(link_block_data[LinkKeys::Vars] || []).each do |(key, value)|
|
1586
|
+
ENV[key] = value.to_s
|
1587
|
+
require 'shellwords'
|
1588
|
+
code_lines.push "#{key}=\"#{Shellwords.escape(value)}\""
|
1589
|
+
end
|
1590
|
+
end
|
1591
|
+
|
1592
|
+
## append blocks loaded, apply LinkKeys::Eval
|
1593
|
+
#
|
1594
|
+
if (load_filespec = link_block_data.fetch(LinkKeys::Load, '')).present?
|
1571
1595
|
code_lines += File.readlines(load_filespec, chomp: true)
|
1572
1596
|
end
|
1573
1597
|
|
1574
1598
|
# if an eval link block, evaluate code_lines and return its standard output
|
1575
1599
|
#
|
1576
|
-
if link_block_data.fetch(
|
1577
|
-
false) || link_block_data.fetch(
|
1600
|
+
if link_block_data.fetch(LinkKeys::Eval,
|
1601
|
+
false) || link_block_data.fetch(LinkKeys::Exec, false)
|
1578
1602
|
code_lines = link_block_data_eval(link_state, code_lines, selected, link_block_data)
|
1579
1603
|
end
|
1580
1604
|
|
1581
|
-
|
1605
|
+
## write variables
|
1606
|
+
#
|
1607
|
+
if (save_filespec = link_block_data.fetch(LinkKeys::Save, '')).present?
|
1608
|
+
File.write(save_filespec, HashDelegator.join_code_lines(link_state&.inherited_lines))
|
1609
|
+
next_document_filename = @delegate_object[:filename]
|
1610
|
+
end
|
1611
|
+
|
1612
|
+
if link_block_data[LinkKeys::Return]
|
1582
1613
|
pop_add_current_code_to_head_and_trigger_load(link_state, block_names, code_lines,
|
1583
1614
|
dependencies, selected)
|
1584
1615
|
|
@@ -1589,7 +1620,7 @@ module MarkdownExec
|
|
1589
1620
|
inherited_block_names: ((link_state&.inherited_block_names || []) + block_names).sort.uniq,
|
1590
1621
|
inherited_dependencies: (link_state&.inherited_dependencies || {}).merge(dependencies || {}), ### merge, not replace, key data
|
1591
1622
|
inherited_lines: HashDelegator.code_merge(link_state&.inherited_lines, code_lines),
|
1592
|
-
next_block_name: link_block_data[
|
1623
|
+
next_block_name: link_block_data.fetch(LinkKeys::NextBlock, nil) || link_block_data[LinkKeys::Block] || '',
|
1593
1624
|
next_document_filename: next_document_filename,
|
1594
1625
|
next_load_file: next_document_filename == @delegate_object[:filename] ? LoadFile::Reuse : LoadFile::Load
|
1595
1626
|
)
|
@@ -1668,8 +1699,13 @@ module MarkdownExec
|
|
1668
1699
|
break
|
1669
1700
|
end
|
1670
1701
|
|
1702
|
+
## order of block name processing
|
1703
|
+
# from link block
|
1704
|
+
# from cli
|
1705
|
+
# from user
|
1706
|
+
#
|
1671
1707
|
link_state.block_name, @run_state.block_name_from_cli, cli_break = \
|
1672
|
-
HashDelegator.next_link_state(!shift_cli_argument, now_using_cli, block_state)
|
1708
|
+
HashDelegator.next_link_state(!link_state.block_name && !shift_cli_argument, now_using_cli, block_state, block_name: link_state.block_name)
|
1673
1709
|
|
1674
1710
|
if !block_state.block[:block_name_from_ui] && cli_break
|
1675
1711
|
# &bsp '!block_name_from_ui + cli_break -> break'
|
@@ -1814,14 +1850,20 @@ module MarkdownExec
|
|
1814
1850
|
end
|
1815
1851
|
|
1816
1852
|
def set_environment_variables_for_block(selected)
|
1853
|
+
code_lines = []
|
1817
1854
|
YAML.load(selected[:body].join("\n"))&.each do |key, value|
|
1818
1855
|
ENV[key] = value.to_s
|
1856
|
+
|
1857
|
+
require 'shellwords'
|
1858
|
+
code_lines.push "#{key}=\"#{Shellwords.escape(value)}\""
|
1859
|
+
|
1819
1860
|
next unless @delegate_object[:menu_vars_set_format].present?
|
1820
1861
|
|
1821
1862
|
formatted_string = format(@delegate_object[:menu_vars_set_format],
|
1822
1863
|
{ key: key, value: value })
|
1823
1864
|
print string_send_color(formatted_string, :menu_vars_set_color)
|
1824
1865
|
end
|
1866
|
+
code_lines
|
1825
1867
|
end
|
1826
1868
|
|
1827
1869
|
def should_add_back_option?
|
@@ -2111,7 +2153,7 @@ module MarkdownExec
|
|
2111
2153
|
LinkState.new(block_name: 'sample_block',
|
2112
2154
|
document_filename: 'sample_file',
|
2113
2155
|
inherited_dependencies: {},
|
2114
|
-
inherited_lines: []))
|
2156
|
+
inherited_lines: ['# ', 'KEY="VALUE"']))
|
2115
2157
|
assert_equal expected_result,
|
2116
2158
|
@hd.push_link_history_and_trigger_load(body, nil, FCB.new(block_name: 'sample_block',
|
2117
2159
|
filename: 'sample_file'))
|
@@ -2282,7 +2324,7 @@ module MarkdownExec
|
|
2282
2324
|
@mdoc.stubs(:collect_recursively_required_code).returns({ code: ['code line'] })
|
2283
2325
|
result = @hd.collect_required_code_lines(@mdoc, @selected, block_source: {})
|
2284
2326
|
|
2285
|
-
assert_equal ['code line'], result
|
2327
|
+
assert_equal ['code line', 'key="value"'], result
|
2286
2328
|
end
|
2287
2329
|
end
|
2288
2330
|
|
data/lib/menu.src.yml
CHANGED
@@ -211,26 +211,11 @@
|
|
211
211
|
tell the first window
|
212
212
|
set bounds to {xoff, yoff, xoff + winWidth, yoff + winHeight}
|
213
213
|
tell the current session
|
214
|
-
write text "
|
215
|
-
write text "
|
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
|
-
|
214
|
+
write text "# %{script_filespec}"
|
215
|
+
write text "# %{output_filespec}"
|
228
216
|
write text "echo -ne \"\\033]; %{started_at} - %{document_filename} - %{block_name} \\007\""
|
229
217
|
write text "cd \"%{home}\""
|
230
218
|
write text "\"%{script_filename}\" | tee \"%{output_filespec}\""
|
231
|
-
delay 2
|
232
|
-
|
233
|
-
write text "menu"
|
234
219
|
end tell
|
235
220
|
end tell
|
236
221
|
end tell'
|
@@ -737,7 +722,7 @@
|
|
737
722
|
:env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
|
738
723
|
:opt_name: output_assignment_format
|
739
724
|
:procname: val_as_str
|
740
|
-
- :default: "^ *(
|
725
|
+
- :default: "^ *(?<line>\\w+=.*?) *$"
|
741
726
|
:description: Pattern for assignments from output
|
742
727
|
:env_var: MDE_OUTPUT_ASSIGNMENT_MATCH
|
743
728
|
:opt_name: output_assignment_match
|
data/lib/menu.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# MDE - Markdown Executor (1.8.
|
1
|
+
# MDE - Markdown Executor (1.8.9)
|
2
2
|
---
|
3
3
|
- :description: Show current configuration values
|
4
4
|
:procname: show_config
|
@@ -173,21 +173,12 @@
|
|
173
173
|
yoff to xoff mod (screenHeight - winHeight)\n \n create window with
|
174
174
|
default profile\n tell the first window\n set bounds to {xoff,
|
175
175
|
yoff, xoff + winWidth, yoff + winHeight}\n tell the current session\n
|
176
|
-
\ write text \"
|
177
|
-
\
|
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];
|
176
|
+
\ write text \"# %{script_filespec}\"\n write text
|
177
|
+
\"# %{output_filespec}\"\n write text \"echo -ne \\\"\\\\033];
|
187
178
|
%{started_at} - %{document_filename} - %{block_name} \\\\007\\\"\"\n write
|
188
179
|
text \"cd \\\"%{home}\\\"\"\n write text \"\\\"%{script_filename}\\\"
|
189
|
-
| tee \\\"%{output_filespec}\\\"\"\n
|
190
|
-
|
180
|
+
| tee \\\"%{output_filespec}\\\"\"\n end tell\n end tell\n end
|
181
|
+
tell'\n"
|
191
182
|
:description: execute_command_format
|
192
183
|
:env_var: MDE_EXECUTE_COMMAND_FORMAT
|
193
184
|
:opt_name: execute_command_format
|
@@ -611,7 +602,7 @@
|
|
611
602
|
:env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
|
612
603
|
:opt_name: output_assignment_format
|
613
604
|
:procname: val_as_str
|
614
|
-
- :default: "^ *(
|
605
|
+
- :default: "^ *(?<line>\\w+=.*?) *$"
|
615
606
|
:description: Pattern for assignments from output
|
616
607
|
:env_var: MDE_OUTPUT_ASSIGNMENT_MATCH
|
617
608
|
:opt_name: output_assignment_match
|
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.9
|
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-01-
|
11
|
+
date: 2024-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|