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/lib/mdoc.rb
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# encoding=utf-8
|
5
|
+
|
6
|
+
require_relative 'filter'
|
7
|
+
|
8
|
+
module MarkdownExec
|
9
|
+
##
|
10
|
+
# MDoc represents an imported markdown document.
|
11
|
+
#
|
12
|
+
# It provides methods to extract and manipulate specific sections
|
13
|
+
# of the document, such as code blocks. It also supports recursion
|
14
|
+
# to fetch related or dependent blocks.
|
15
|
+
#
|
16
|
+
class MDoc
|
17
|
+
attr_reader :table
|
18
|
+
|
19
|
+
# convert block name to fcb_parse
|
20
|
+
#
|
21
|
+
def initialize(table)
|
22
|
+
@table = table
|
23
|
+
end
|
24
|
+
|
25
|
+
def collect_recursively_required_code(name)
|
26
|
+
get_required_blocks(name)
|
27
|
+
.map do |fcb|
|
28
|
+
body = fcb[:body].join("\n")
|
29
|
+
|
30
|
+
if fcb[:cann]
|
31
|
+
xcall = fcb[:cann][1..-2]
|
32
|
+
mstdin = xcall.match(/<(?<type>\$)?(?<name>[A-Za-z_\-.\w]+)/)
|
33
|
+
mstdout = xcall.match(/>(?<type>\$)?(?<name>[A-Za-z_\-.\w]+)/)
|
34
|
+
|
35
|
+
yqcmd = if mstdin[:type]
|
36
|
+
"echo \"$#{mstdin[:name]}\" | yq '#{body}'"
|
37
|
+
else
|
38
|
+
"yq e '#{body}' '#{mstdin[:name]}'"
|
39
|
+
end
|
40
|
+
if mstdout[:type]
|
41
|
+
"export #{mstdout[:name]}=$(#{yqcmd})"
|
42
|
+
else
|
43
|
+
"#{yqcmd} > '#{mstdout[:name]}'"
|
44
|
+
end
|
45
|
+
elsif fcb[:stdout]
|
46
|
+
stdout = fcb[:stdout]
|
47
|
+
body = fcb[:body].join("\n")
|
48
|
+
if stdout[:type]
|
49
|
+
%(export #{stdout[:name]}=$(cat <<"EOF"\n#{body}\nEOF\n))
|
50
|
+
else
|
51
|
+
"cat > '#{stdout[:name]}' <<\"EOF\"\n" \
|
52
|
+
"#{body}\n" \
|
53
|
+
"EOF\n"
|
54
|
+
end
|
55
|
+
else
|
56
|
+
fcb[:body]
|
57
|
+
end
|
58
|
+
end.flatten(1)
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_block_by_name(name, default = {})
|
62
|
+
@table.select { |fcb| fcb.fetch(:name, '') == name }.fetch(0, default)
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_required_blocks(name)
|
66
|
+
name_block = get_block_by_name(name)
|
67
|
+
raise "Named code block `#{name}` not found." if name_block.nil? || name_block.keys.empty?
|
68
|
+
|
69
|
+
all = [name_block.fetch(:name, '')] + recursively_required(name_block[:reqs])
|
70
|
+
|
71
|
+
# in order of appearance in document
|
72
|
+
# insert function blocks
|
73
|
+
@table.select { |fcb| all.include? fcb.fetch(:name, '') }
|
74
|
+
.map do |fcb|
|
75
|
+
if (call = fcb[:call])
|
76
|
+
[get_block_by_name("[#{call.match(/^%\((\S+) |\)/)[1]}]")
|
77
|
+
.merge({ cann: call })]
|
78
|
+
else
|
79
|
+
[]
|
80
|
+
end + [fcb]
|
81
|
+
end.flatten(1)
|
82
|
+
end
|
83
|
+
|
84
|
+
# :reek:UtilityFunction
|
85
|
+
def hide_menu_block_per_options(opts, block)
|
86
|
+
(opts[:hide_blocks_by_name] &&
|
87
|
+
block[:name]&.match(Regexp.new(opts[:block_name_hidden_match])) &&
|
88
|
+
(block[:name]&.present? || block[:label]&.present?)
|
89
|
+
)
|
90
|
+
end
|
91
|
+
|
92
|
+
def fcbs_per_options(opts = {})
|
93
|
+
options = opts.merge(block_name_hidden_match: nil)
|
94
|
+
selrows = @table.select do |fcb_title_groups|
|
95
|
+
Filter.fcb_select? options, fcb_title_groups
|
96
|
+
end
|
97
|
+
|
98
|
+
### hide rows correctly
|
99
|
+
|
100
|
+
if opts[:hide_blocks_by_name]
|
101
|
+
selrows.reject { |block| hide_menu_block_per_options opts, block }
|
102
|
+
else
|
103
|
+
selrows
|
104
|
+
end.map do |block|
|
105
|
+
# block[:name] = block[:text] if block[:name].nil?
|
106
|
+
block
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def recursively_required(reqs)
|
111
|
+
return [] unless reqs
|
112
|
+
|
113
|
+
rem = reqs
|
114
|
+
memo = []
|
115
|
+
while rem.count.positive?
|
116
|
+
rem = rem.map do |req|
|
117
|
+
next if memo.include? req
|
118
|
+
|
119
|
+
memo += [req]
|
120
|
+
get_block_by_name(req).fetch(:reqs, [])
|
121
|
+
end
|
122
|
+
.compact
|
123
|
+
.flatten(1)
|
124
|
+
end
|
125
|
+
memo
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
if $PROGRAM_NAME == __FILE__
|
131
|
+
# require 'bundler/setup'
|
132
|
+
# Bundler.require(:default)
|
133
|
+
|
134
|
+
require 'minitest/autorun'
|
135
|
+
|
136
|
+
require_relative 'tap'
|
137
|
+
include Tap
|
138
|
+
|
139
|
+
module MarkdownExec
|
140
|
+
class TestMDoc < Minitest::Test
|
141
|
+
def setup
|
142
|
+
@table = [
|
143
|
+
{ name: 'block1', body: ['code for block1'], reqs: ['block2'] },
|
144
|
+
{ name: 'block2', body: ['code for block2'], reqs: nil },
|
145
|
+
{ name: 'block3', body: ['code for block3'], reqs: ['block1'] }
|
146
|
+
]
|
147
|
+
@doc = MDoc.new(@table)
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_collect_recursively_required_code
|
151
|
+
result = @doc.collect_recursively_required_code('block1')
|
152
|
+
expected_result = @table[0][:body] + @table[1][:body]
|
153
|
+
assert_equal expected_result, result
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_get_block_by_name
|
157
|
+
result = @doc.get_block_by_name('block1')
|
158
|
+
assert_equal @table[0], result
|
159
|
+
|
160
|
+
result_missing = @doc.get_block_by_name('missing_block')
|
161
|
+
assert_equal({}, result_missing)
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_get_required_blocks
|
165
|
+
result = @doc.get_required_blocks('block3')
|
166
|
+
expected_result = [@table[0], @table[1], @table[2]]
|
167
|
+
assert_equal expected_result, result
|
168
|
+
|
169
|
+
assert_raises(RuntimeError) { @doc.get_required_blocks('missing_block') }
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_hide_menu_block_per_options
|
173
|
+
opts = { hide_blocks_by_name: true, block_name_hidden_match: 'block1' }
|
174
|
+
block = { name: 'block1' }
|
175
|
+
result = @doc.hide_menu_block_per_options(opts, block)
|
176
|
+
assert result # this should be true based on the given logic
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_fcbs_per_options
|
180
|
+
opts = { hide_blocks_by_name: true, block_name_hidden_match: 'block1' }
|
181
|
+
result = @doc.fcbs_per_options(opts)
|
182
|
+
assert_equal [@table[1], @table[2]], result
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_recursively_required
|
186
|
+
result = @doc.recursively_required(['block3'])
|
187
|
+
assert_equal %w[block3 block1 block2], result
|
188
|
+
|
189
|
+
result_no_reqs = @doc.recursively_required(nil)
|
190
|
+
assert_equal [], result_no_reqs
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
data/lib/menu.src.yml
ADDED
@@ -0,0 +1,448 @@
|
|
1
|
+
---
|
2
|
+
- :arg_name: NAME
|
3
|
+
:compreply: false
|
4
|
+
:description: Name of block
|
5
|
+
:env_var: MDE_BLOCK_NAME
|
6
|
+
:long_name: block-name
|
7
|
+
:opt_name: block_name
|
8
|
+
:short_name: b
|
9
|
+
:procname: val_as_str
|
10
|
+
- :arg_name: PATH
|
11
|
+
:default: "."
|
12
|
+
:description: Read configuration file
|
13
|
+
:long_name: config
|
14
|
+
:procname: path
|
15
|
+
- :arg_name: BOOL
|
16
|
+
:default: false
|
17
|
+
:description: Debug output
|
18
|
+
:env_var: MDE_DEBUG
|
19
|
+
:long_name: debug
|
20
|
+
:short_name: d
|
21
|
+
:procname: debug
|
22
|
+
- :arg_name: RELATIVE_PATH
|
23
|
+
:compreply: "."
|
24
|
+
:description: Name of document
|
25
|
+
:env_var: MDE_FILENAME
|
26
|
+
:long_name: filename
|
27
|
+
:opt_name: filename
|
28
|
+
:short_name: f
|
29
|
+
:procname: val_as_str
|
30
|
+
- :description: App help
|
31
|
+
:long_name: help
|
32
|
+
:short_name: h
|
33
|
+
:procname: help
|
34
|
+
- :arg_name: RELATIVE_PATH
|
35
|
+
:default: "."
|
36
|
+
:description: Path to documents
|
37
|
+
:env_var: MDE_PATH
|
38
|
+
:long_name: path
|
39
|
+
:opt_name: path
|
40
|
+
:short_name: p
|
41
|
+
:procname: val_as_str
|
42
|
+
- :arg_name: BOOL
|
43
|
+
:default: true
|
44
|
+
:description: Pause for user to approve script
|
45
|
+
:env_var: MDE_USER_MUST_APPROVE
|
46
|
+
:long_name: user-must-approve
|
47
|
+
:opt_name: user_must_approve
|
48
|
+
:short_name: q
|
49
|
+
:procname: val_as_bool
|
50
|
+
- :description: Print the gem's version
|
51
|
+
:long_name: version
|
52
|
+
:short_name: v
|
53
|
+
:procname: version
|
54
|
+
- :description: Exit app
|
55
|
+
:long_name: exit
|
56
|
+
:short_name: x
|
57
|
+
:procname: exit
|
58
|
+
- :description: Show current configuration values
|
59
|
+
:short_name: '0'
|
60
|
+
:procname: show_config
|
61
|
+
- :description: List blocks
|
62
|
+
:long_name: list-blocks
|
63
|
+
:opt_name: list_blocks
|
64
|
+
:procname: val_as_bool
|
65
|
+
- :description: List default configuration as environment variables
|
66
|
+
:long_name: list-default-env
|
67
|
+
:opt_name: list_default_env
|
68
|
+
- :description: List default configuration as YAML
|
69
|
+
:long_name: list-default-yaml
|
70
|
+
:opt_name: list_default_yaml
|
71
|
+
- :description: List docs in current folder
|
72
|
+
:long_name: list-docs
|
73
|
+
:opt_name: list_docs
|
74
|
+
:procname: val_as_bool
|
75
|
+
- :description: List recent saved output
|
76
|
+
:long_name: list-recent-output
|
77
|
+
:opt_name: list_recent_output
|
78
|
+
:procname: val_as_bool
|
79
|
+
- :description: List recent saved scripts
|
80
|
+
:long_name: list-recent-scripts
|
81
|
+
:opt_name: list_recent_scripts
|
82
|
+
:procname: val_as_bool
|
83
|
+
- :description: Select and execute a recently saved output
|
84
|
+
:long_name: select-recent-output
|
85
|
+
:opt_name: select_recent_output
|
86
|
+
:procname: val_as_bool
|
87
|
+
- :description: Select and execute a recently saved script
|
88
|
+
:long_name: select-recent-script
|
89
|
+
:opt_name: select_recent_script
|
90
|
+
:procname: val_as_bool
|
91
|
+
- :description: List tab completions
|
92
|
+
:long_name: tab-completions
|
93
|
+
:opt_name: tab_completions
|
94
|
+
:procname: val_as_bool
|
95
|
+
- :description: Run most recently saved script
|
96
|
+
:long_name: run-last-script
|
97
|
+
:opt_name: run_last_script
|
98
|
+
:procname: val_as_bool
|
99
|
+
- :description: Gem home folder
|
100
|
+
:long_name: pwd
|
101
|
+
:opt_name: pwd
|
102
|
+
:procname: val_as_bool
|
103
|
+
- :arg_name: BOOL
|
104
|
+
:default: false
|
105
|
+
:description: Display only blocks of type "bash"
|
106
|
+
:env_var: MDE_BASH_ONLY
|
107
|
+
:opt_name: bash_only
|
108
|
+
:procname: val_as_bool
|
109
|
+
- :arg_name: BOOL
|
110
|
+
:default: false
|
111
|
+
:description: Hide decorative menu entries
|
112
|
+
:env_var: MDE_NO_CHROME
|
113
|
+
:opt_name: no_chrome
|
114
|
+
:procname: val_as_bool
|
115
|
+
- :arg_name: REGEX
|
116
|
+
:default:
|
117
|
+
:description: Exclude blocks with name matching
|
118
|
+
:env_var: MDE_EXCLUDE_BY_NAME_REGEX
|
119
|
+
:opt_name: exclude_by_name_regex
|
120
|
+
:procname: val_as_str
|
121
|
+
- :arg_name: REGEX
|
122
|
+
:default:
|
123
|
+
:description: Exclude blocks with shell matching
|
124
|
+
:env_var: MDE_EXCLUDE_BY_SHELL_REGEX
|
125
|
+
:opt_name: exclude_by_shell_regex
|
126
|
+
:procname: val_as_str
|
127
|
+
- :arg_name: BOOL
|
128
|
+
:default: true
|
129
|
+
:description: Hide all blocks of type "expect"
|
130
|
+
:env_var: MDE_EXCLUDE_EXPECT_BLOCKS
|
131
|
+
:opt_name: exclude_expect_blocks
|
132
|
+
:procname: val_as_bool
|
133
|
+
- :arg_name: BOOL
|
134
|
+
:default: true
|
135
|
+
:description: |-
|
136
|
+
Exclude blocks with name matching expression " \
|
137
|
+
"`block_name_hidden_match`
|
138
|
+
:env_var: MDE_HIDE_BLOCKS_BY_NAME
|
139
|
+
:opt_name: hide_blocks_by_name
|
140
|
+
:procname: val_as_bool
|
141
|
+
- :arg_name: INT.1-
|
142
|
+
:default: 32
|
143
|
+
:description: Max. items to return in list
|
144
|
+
:env_var: MDE_LIST_COUNT
|
145
|
+
:long_name: list-count
|
146
|
+
:opt_name: list_count
|
147
|
+
:procname: val_as_int
|
148
|
+
- :arg_name: PREFIX
|
149
|
+
:default: mde
|
150
|
+
:description: Name prefix for stdout files
|
151
|
+
:env_var: MDE_LOGGED_STDOUT_FILENAME_PREFIX
|
152
|
+
:opt_name: logged_stdout_filename_prefix
|
153
|
+
:procname: val_as_str
|
154
|
+
- :arg_name: BOOL
|
155
|
+
:default: false
|
156
|
+
:description: Display document name in block selection menu
|
157
|
+
:env_var: MDE_MENU_BLOCKS_WITH_DOCNAME
|
158
|
+
:opt_name: menu_blocks_with_docname
|
159
|
+
:procname: val_as_bool
|
160
|
+
- :arg_name: BOOL
|
161
|
+
:default: false
|
162
|
+
:description: Display headings (levels 1,2,3) in block selection menu
|
163
|
+
:env_var: MDE_MENU_BLOCKS_WITH_HEADINGS
|
164
|
+
:opt_name: menu_blocks_with_headings
|
165
|
+
:procname: val_as_bool
|
166
|
+
- :arg_name: BOOL
|
167
|
+
:default: true
|
168
|
+
:description: Display Exit option at top of menu
|
169
|
+
:env_var: MDE_MENU_EXIT_AT_TOP
|
170
|
+
:opt_name: menu_exit_at_top
|
171
|
+
:procname: val_as_bool
|
172
|
+
- :arg_name: BOOL
|
173
|
+
:default: true
|
174
|
+
:description: Display Exit option in menu
|
175
|
+
:env_var: MDE_MENU_WITH_EXIT
|
176
|
+
:opt_name: menu_with_exit
|
177
|
+
:procname: val_as_bool
|
178
|
+
- :arg_name: BOOL
|
179
|
+
:default: false
|
180
|
+
:description: Display summary for execution
|
181
|
+
:env_var: MDE_OUTPUT_EXECUTION_SUMMARY
|
182
|
+
:long_name: output-execution-summary
|
183
|
+
:opt_name: output_execution_summary
|
184
|
+
:procname: val_as_bool
|
185
|
+
- :arg_name: BOOL
|
186
|
+
:default: false
|
187
|
+
:description: Output saved script filename at end of execution
|
188
|
+
:env_var: MDE_OUTPUT_SAVED_SCRIPT_FILENAME
|
189
|
+
:opt_name: output_saved_script_filename
|
190
|
+
:procname: val_as_bool
|
191
|
+
- :arg_name: BOOL
|
192
|
+
:default: false
|
193
|
+
:description: Display script prior to execution
|
194
|
+
:env_var: MDE_OUTPUT_SCRIPT
|
195
|
+
:long_name: output-script
|
196
|
+
:opt_name: output_script
|
197
|
+
:procname: val_as_bool
|
198
|
+
- :arg_name: BOOL
|
199
|
+
:default: true
|
200
|
+
:description: Display standard output from execution
|
201
|
+
:env_var: MDE_OUTPUT_STDOUT
|
202
|
+
:long_name: output-stdout
|
203
|
+
:opt_name: output_stdout
|
204
|
+
:procname: val_as_bool
|
205
|
+
- :arg_name: BOOL
|
206
|
+
:default: false
|
207
|
+
:description: Save executed script
|
208
|
+
:env_var: MDE_SAVE_EXECUTED_SCRIPT
|
209
|
+
:long_name: save-executed-script
|
210
|
+
:opt_name: save_executed_script
|
211
|
+
:procname: val_as_bool
|
212
|
+
- :arg_name: BOOL
|
213
|
+
:default: false
|
214
|
+
:description: Save standard output of the executed script
|
215
|
+
:env_var: MDE_SAVE_EXECUTION_OUTPUT
|
216
|
+
:long_name: save-execution-output
|
217
|
+
:opt_name: save_execution_output
|
218
|
+
:procname: val_as_bool
|
219
|
+
- :arg_name: INT
|
220
|
+
:default: 493
|
221
|
+
:description: chmod for saved scripts
|
222
|
+
:env_var: MDE_SAVED_SCRIPT_CHMOD
|
223
|
+
:opt_name: saved_script_chmod
|
224
|
+
:procname: val_as_int
|
225
|
+
- :arg_name: PREFIX
|
226
|
+
:default: mde
|
227
|
+
:description: Name prefix for saved scripts
|
228
|
+
:env_var: MDE_SAVED_SCRIPT_FILENAME_PREFIX
|
229
|
+
:opt_name: saved_script_filename_prefix
|
230
|
+
:procname: val_as_str
|
231
|
+
- :arg_name: RELATIVE_PATH
|
232
|
+
:default: logs
|
233
|
+
:description: Saved script folder
|
234
|
+
:env_var: MDE_SAVED_SCRIPT_FOLDER
|
235
|
+
:long_name: saved-script-folder
|
236
|
+
:opt_name: saved_script_folder
|
237
|
+
:procname: val_as_str
|
238
|
+
- :arg_name: GLOB
|
239
|
+
:default: mde_*.sh
|
240
|
+
:description: Glob matching saved scripts
|
241
|
+
:env_var: MDE_SAVED_SCRIPT_GLOB
|
242
|
+
:opt_name: saved_script_glob
|
243
|
+
:procname: val_as_str
|
244
|
+
- :arg_name: RELATIVE_PATH
|
245
|
+
:default: logs
|
246
|
+
:description: Saved stdout folder
|
247
|
+
:env_var: MDE_SAVED_STDOUT_FOLDER
|
248
|
+
:long_name: saved-stdout-folder
|
249
|
+
:opt_name: saved_stdout_folder
|
250
|
+
:procname: val_as_str
|
251
|
+
- :arg_name: GLOB
|
252
|
+
:default: mde_*.out.txt
|
253
|
+
:description: Glob matching saved outputs
|
254
|
+
:env_var: MDE_SAVED_STDOUT_GLOB
|
255
|
+
:opt_name: saved_stdout_glob
|
256
|
+
:procname: val_as_str
|
257
|
+
- :arg_name: REGEX
|
258
|
+
:default:
|
259
|
+
:description: Select blocks with name matching
|
260
|
+
:env_var: MDE_SELECT_BY_NAME_REGEX
|
261
|
+
:opt_name: select_by_name_regex
|
262
|
+
:procname: val_as_str
|
263
|
+
- :arg_name: REGEX
|
264
|
+
:default:
|
265
|
+
:description: Select blocks with shell matching
|
266
|
+
:env_var: MDE_SELECT_BY_SHELL_REGEX
|
267
|
+
:opt_name: select_by_shell_regex
|
268
|
+
:procname: val_as_str
|
269
|
+
- :default: "^[\\(\\[].*[\\)\\]]$"
|
270
|
+
:description: Pattern for blocks to hide from user-selection
|
271
|
+
:env_var: MDE_BLOCK_NAME_HIDDEN_MATCH
|
272
|
+
:opt_name: block_name_hidden_match
|
273
|
+
:procname: val_as_str
|
274
|
+
- :default: ":(?<title>\\S+)( |$)"
|
275
|
+
:env_var: MDE_BLOCK_NAME_MATCH
|
276
|
+
:opt_name: block_name_match
|
277
|
+
:procname: val_as_str
|
278
|
+
- :default: "%\\([^\\)]+\\)"
|
279
|
+
:env_var: MDE_BLOCK_CALLS_SCAN
|
280
|
+
:opt_name: block_calls_scan
|
281
|
+
:procname: val_as_str
|
282
|
+
- :default: "\\+\\S+"
|
283
|
+
:env_var: MDE_BLOCK_REQUIRED_SCAN
|
284
|
+
:opt_name: block_required_scan
|
285
|
+
:procname: val_as_str
|
286
|
+
- :default: "<(?<full>(?<type>\\$)?(?<name>[A-Za-z_\\-\\.\\w]+))"
|
287
|
+
:env_var: MDE_BLOCK_STDIN_SCAN
|
288
|
+
:opt_name: block_stdin_scan
|
289
|
+
:procname: val_as_str
|
290
|
+
- :default: ">(?<full>(?<type>\\$)?(?<name>[A-Za-z_\\-\\.\\w]+))"
|
291
|
+
:env_var: MDE_BLOCK_STDOUT_SCAN
|
292
|
+
:opt_name: block_stdout_scan
|
293
|
+
:procname: val_as_str
|
294
|
+
- :default: "> "
|
295
|
+
:env_var: MDE_DISPLAY_LEVEL_XBASE_PREFIX
|
296
|
+
:opt_name: display_level_xbase_prefix
|
297
|
+
:procname: val_as_str
|
298
|
+
- :default: "^`{3,}"
|
299
|
+
:env_var: MDE_FENCED_START_AND_END_MATCH
|
300
|
+
:opt_name: fenced_start_and_end_match
|
301
|
+
:procname: val_as_str
|
302
|
+
- :default: "^`{3,}(?<shell>[^`\\s]*) *:?(?<name>[^\\s]*) *(?<rest>.*) *$"
|
303
|
+
:env_var: MDE_FENCED_START_EX_MATCH
|
304
|
+
:opt_name: fenced_start_ex_match
|
305
|
+
:procname: val_as_str
|
306
|
+
- :default: "^# *(?<name>[^#]*?) *$"
|
307
|
+
:env_var: MDE_HEADING1_MATCH
|
308
|
+
:opt_name: heading1_match
|
309
|
+
:procname: val_as_str
|
310
|
+
- :default: "^## *(?<name>[^#]*?) *$"
|
311
|
+
:env_var: MDE_HEADING2_MATCH
|
312
|
+
:opt_name: heading2_match
|
313
|
+
:procname: val_as_str
|
314
|
+
- :default: "^### *(?<name>.+?) *$"
|
315
|
+
:env_var: MDE_HEADING3_MATCH
|
316
|
+
:opt_name: heading3_match
|
317
|
+
:procname: val_as_str
|
318
|
+
- :default: "^ *@import (.+)$"
|
319
|
+
:env_var: MDE_IMPORT_PATTERN
|
320
|
+
:opt_name: import_pattern
|
321
|
+
:procname: val_as_str
|
322
|
+
- :default: "*.[Mm][Dd]"
|
323
|
+
:env_var: MDE_MD_FILENAME_GLOB
|
324
|
+
:opt_name: md_filename_glob
|
325
|
+
:procname: val_as_str
|
326
|
+
- :default: ".+\\.md"
|
327
|
+
:env_var: MDE_MD_FILENAME_MATCH
|
328
|
+
:opt_name: md_filename_match
|
329
|
+
:procname: val_as_str
|
330
|
+
- :default: "-:= %s =:-"
|
331
|
+
:description: format for menu dividers and demarcations
|
332
|
+
:env_var: MDE_MENU_DIVIDER_FORMAT
|
333
|
+
:opt_name: menu_divider_format
|
334
|
+
:procname: val_as_str
|
335
|
+
- :default: magenta
|
336
|
+
:description: Color of menu divider
|
337
|
+
:env_var: MDE_MENU_DIVIDER_COLOR
|
338
|
+
:opt_name: menu_divider_color
|
339
|
+
:procname: val_as_str
|
340
|
+
- :default: "^::: +(?<name>.+?)$"
|
341
|
+
:description: Pattern for topics/dividers in block selection menu
|
342
|
+
:env_var: MDE_MENU_DIVIDER_MATCH
|
343
|
+
:opt_name: menu_divider_match
|
344
|
+
:procname: val_as_str
|
345
|
+
- :default: ">"
|
346
|
+
:description: Symbol before each divider
|
347
|
+
:env_var: MDE_MENU_DIVIDER_SYMBOL
|
348
|
+
:opt_name: menu_divider_symbol
|
349
|
+
:procname: val_as_str
|
350
|
+
- :default: "~~~"
|
351
|
+
:description: closing demarcations for menu
|
352
|
+
:env_var: MDE_MENU_FINAL_DIVIDER
|
353
|
+
:opt_name: menu_final_divider
|
354
|
+
:procname: val_as_str
|
355
|
+
- :default: ''
|
356
|
+
:description: opening demarcation for menu
|
357
|
+
:env_var: MDE_MENU_INITIAL_DIVIDER
|
358
|
+
:opt_name: menu_initial_divider
|
359
|
+
:procname: val_as_str
|
360
|
+
- :default: "[%{status}] %{name}"
|
361
|
+
:description: format for menu tasks and demarcations
|
362
|
+
:env_var: MDE_MENU_TASK_FORMAT
|
363
|
+
:opt_name: menu_task_format
|
364
|
+
:procname: val_as_str
|
365
|
+
- :default: cyan
|
366
|
+
:description: Color of menu task
|
367
|
+
:env_var: MDE_MENU_TASK_COLOR
|
368
|
+
:opt_name: menu_task_color
|
369
|
+
:procname: val_as_str
|
370
|
+
- :default: "^ *\\[(?<status>.{1,4})\\] *(?<name>.*) *$"
|
371
|
+
:description: Pattern for tasks
|
372
|
+
:env_var: MDE_MENU_TASK_MATCH
|
373
|
+
:opt_name: menu_task_match
|
374
|
+
:procname: val_as_str
|
375
|
+
- :default: ">"
|
376
|
+
:description: Symbol before each task
|
377
|
+
:env_var: MDE_MENU_TASK_SYMBOL
|
378
|
+
:opt_name: menu_task_symbol
|
379
|
+
:procname: val_as_str
|
380
|
+
- :description: Options for viewing saved output file
|
381
|
+
:env_var: MDE_OUTPUT_VIEWER_OPTIONS
|
382
|
+
:opt_name: output_viewer_options
|
383
|
+
:procname: val_as_str
|
384
|
+
- :default: 36
|
385
|
+
:description: 'Maximum # of rows in select list'
|
386
|
+
:env_var: MDE_SELECT_PAGE_HEIGHT
|
387
|
+
:opt_name: select_page_height
|
388
|
+
:procname: val_as_int
|
389
|
+
- :default: "#!/usr/bin/env"
|
390
|
+
:description: Shebang for saved scripts
|
391
|
+
:env_var: MDE_SHEBANG
|
392
|
+
:opt_name: shebang
|
393
|
+
:procname: val_as_str
|
394
|
+
- :default: bash
|
395
|
+
:description: Shell for launched scripts
|
396
|
+
:env_var: MDE_SHELL
|
397
|
+
:opt_name: shell
|
398
|
+
:procname: val_as_str
|
399
|
+
- :default: Process?
|
400
|
+
:description: Prompt to approve a block
|
401
|
+
:env_var: MDE_PROMPT_APPROVE_BLOCK
|
402
|
+
:opt_name: prompt_approve_block
|
403
|
+
:procname: val_as_str
|
404
|
+
- :default: 'Choose a block:'
|
405
|
+
:description: Prompt to select a block
|
406
|
+
:env_var: MDE_PROMPT_SELECT_BLOCK
|
407
|
+
:opt_name: prompt_select_block
|
408
|
+
:procname: val_as_str
|
409
|
+
- :default: 'Choose a file:'
|
410
|
+
:description: Prompt to select a markdown document
|
411
|
+
:env_var: MDE_PROMPT_SELECT_MD
|
412
|
+
:opt_name: prompt_select_md
|
413
|
+
:procname: val_as_str
|
414
|
+
- :default: 'Choose a file:'
|
415
|
+
:description: Prompt to select a saved file
|
416
|
+
:env_var: MDE_PROMPT_SELECT_OUTPUT
|
417
|
+
:opt_name: prompt_select_output
|
418
|
+
:procname: val_as_str
|
419
|
+
- :default: Copy script to clipboard
|
420
|
+
:description: Prompt to copy script to clipboard
|
421
|
+
:env_var: MDE_PROMPT_SCRIPT_TO_CLIPBOARD
|
422
|
+
:opt_name: prompt_script_to_clipboard
|
423
|
+
:procname: val_as_str
|
424
|
+
- :default: Save script
|
425
|
+
:description: Prompt to save script
|
426
|
+
:env_var: MDE_PROMPT_SAVE_SCRIPT
|
427
|
+
:opt_name: prompt_save_script
|
428
|
+
:procname: val_as_str
|
429
|
+
- :default: 'No'
|
430
|
+
:description: Prompt for no
|
431
|
+
:env_var: MDE_PROMPT_NO
|
432
|
+
:opt_name: prompt_no
|
433
|
+
:procname: val_as_str
|
434
|
+
- :default: 'Yes'
|
435
|
+
:description: Prompt for yes
|
436
|
+
:env_var: MDE_PROMPT_YES
|
437
|
+
:opt_name: prompt_yes
|
438
|
+
:procname: val_as_str
|
439
|
+
- :default: " #=#=#"
|
440
|
+
:description: Output divider
|
441
|
+
:env_var: MDE_OUTPUT_DIVIDER
|
442
|
+
:opt_name: output_divider
|
443
|
+
:procname: val_as_str
|
444
|
+
- :default: yellow
|
445
|
+
:description: Color of output divider
|
446
|
+
:env_var: MDE_OUTPUT_DIVIDER_COLOR
|
447
|
+
:opt_name: output_divider_color
|
448
|
+
:procname: val_as_str
|
data/lib/menu.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# MDE - Markdown Executor (1.3.
|
1
|
+
# MDE - Markdown Executor (1.3.6)
|
2
2
|
---
|
3
3
|
- :arg_name: NAME
|
4
4
|
:compreply: false
|
@@ -107,13 +107,12 @@
|
|
107
107
|
:env_var: MDE_BASH_ONLY
|
108
108
|
:opt_name: bash_only
|
109
109
|
:procname: val_as_bool
|
110
|
-
- :arg_name:
|
111
|
-
:default:
|
112
|
-
:description:
|
113
|
-
:env_var:
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:procname: val_as_int
|
110
|
+
- :arg_name: BOOL
|
111
|
+
:default: false
|
112
|
+
:description: Hide decorative menu entries
|
113
|
+
:env_var: MDE_NO_CHROME
|
114
|
+
:opt_name: no_chrome
|
115
|
+
:procname: val_as_bool
|
117
116
|
- :arg_name: REGEX
|
118
117
|
:default:
|
119
118
|
:description: Exclude blocks with name matching
|
@@ -136,7 +135,7 @@
|
|
136
135
|
:default: true
|
137
136
|
:description: |-
|
138
137
|
Exclude blocks with name matching expression " \
|
139
|
-
|
138
|
+
"`block_name_hidden_match`
|
140
139
|
:env_var: MDE_HIDE_BLOCKS_BY_NAME
|
141
140
|
:opt_name: hide_blocks_by_name
|
142
141
|
:procname: val_as_bool
|
@@ -359,6 +358,26 @@
|
|
359
358
|
:env_var: MDE_MENU_INITIAL_DIVIDER
|
360
359
|
:opt_name: menu_initial_divider
|
361
360
|
:procname: val_as_str
|
361
|
+
- :default: "[%{status}] %{name}"
|
362
|
+
:description: format for menu tasks and demarcations
|
363
|
+
:env_var: MDE_MENU_TASK_FORMAT
|
364
|
+
:opt_name: menu_task_format
|
365
|
+
:procname: val_as_str
|
366
|
+
- :default: cyan
|
367
|
+
:description: Color of menu task
|
368
|
+
:env_var: MDE_MENU_TASK_COLOR
|
369
|
+
:opt_name: menu_task_color
|
370
|
+
:procname: val_as_str
|
371
|
+
- :default: "^ *\\[(?<status>.{1,4})\\] *(?<name>.*) *$"
|
372
|
+
:description: Pattern for tasks
|
373
|
+
:env_var: MDE_MENU_TASK_MATCH
|
374
|
+
:opt_name: menu_task_match
|
375
|
+
:procname: val_as_str
|
376
|
+
- :default: ">"
|
377
|
+
:description: Symbol before each task
|
378
|
+
:env_var: MDE_MENU_TASK_SYMBOL
|
379
|
+
:opt_name: menu_task_symbol
|
380
|
+
:procname: val_as_str
|
362
381
|
- :description: Options for viewing saved output file
|
363
382
|
:env_var: MDE_OUTPUT_VIEWER_OPTIONS
|
364
383
|
:opt_name: output_viewer_options
|
@@ -428,3 +447,10 @@
|
|
428
447
|
:env_var: MDE_OUTPUT_DIVIDER_COLOR
|
429
448
|
:opt_name: output_divider_color
|
430
449
|
:procname: val_as_str
|
450
|
+
- :arg_name: INT.0-3
|
451
|
+
:default: 1
|
452
|
+
:description: Output display level (0 to 3 [data, +context, +info])
|
453
|
+
:env_var: MDE_DISPLAY_LEVEL
|
454
|
+
:long_name: display-level
|
455
|
+
:opt_name: display_level
|
456
|
+
:procname: val_as_int
|
data/lib/menu_options.rb
ADDED
File without changes
|
File without changes
|