markdown_exec 2.0.4 → 2.0.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 +12 -5
- data/CHANGELOG.md +27 -0
- data/Gemfile.lock +1 -1
- data/bin/tab_completion.sh +15 -31
- data/examples/block_names.md +23 -0
- data/examples/linked.md +8 -0
- data/examples/linked_show.md +7 -0
- data/examples/load_code.md +10 -0
- data/examples/search.md +21 -0
- data/lib/color_scheme.rb +65 -0
- data/lib/constants.rb +18 -19
- data/lib/directory_searcher.rb +4 -2
- data/lib/find_files.rb +36 -42
- data/lib/hash_delegator.rb +842 -571
- data/lib/input_sequencer.rb +16 -9
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +146 -31
- data/lib/menu.src.yml +76 -19
- data/lib/menu.yml +68 -12
- data/lib/std_out_err_logger.rb +12 -14
- metadata +7 -2
data/lib/input_sequencer.rb
CHANGED
@@ -19,7 +19,12 @@ class InputSequencer
|
|
19
19
|
@document_filename = document_filename
|
20
20
|
@current_block = nil
|
21
21
|
@block_queue = initial_blocks
|
22
|
-
@debug = Env
|
22
|
+
@debug = Env.env_bool('INPUT_SEQUENCER_DEBUG', default: false)
|
23
|
+
# rubocop:disable Style/RescueStandardError
|
24
|
+
rescue
|
25
|
+
pp $!, $@
|
26
|
+
exit 1
|
27
|
+
# rubocop:enable Style/RescueStandardError
|
23
28
|
end
|
24
29
|
|
25
30
|
# Merges the current menu state with the next, prioritizing the next state's values.
|
@@ -33,9 +38,11 @@ class InputSequencer
|
|
33
38
|
inherited_lines: next_state.inherited_lines,
|
34
39
|
prior_block_was_link: next_state.prior_block_was_link.nil? ? current.prior_block_was_link : next_state.prior_block_was_link
|
35
40
|
)
|
41
|
+
# rubocop:disable Style/RescueStandardError
|
36
42
|
rescue
|
37
43
|
pp $!, $@
|
38
44
|
exit 1
|
45
|
+
# rubocop:enable Style/RescueStandardError
|
39
46
|
end
|
40
47
|
|
41
48
|
# Generates the next menu state based on provided attributes.
|
@@ -52,6 +59,11 @@ class InputSequencer
|
|
52
59
|
# Orchestrates the flow of menu states and user interactions.
|
53
60
|
def run_yield(sym, *args, &block)
|
54
61
|
block.call sym, *args
|
62
|
+
# rubocop:disable Style/RescueStandardError
|
63
|
+
rescue
|
64
|
+
pp $!, $@
|
65
|
+
exit 1
|
66
|
+
# rubocop:enable Style/RescueStandardError
|
55
67
|
end
|
56
68
|
|
57
69
|
def bq_is_empty?
|
@@ -69,7 +81,6 @@ class InputSequencer
|
|
69
81
|
loop do
|
70
82
|
break if run_yield(:parse_document, now_menu.document_filename, &block) == :break
|
71
83
|
|
72
|
-
pp [__LINE__, 'exit_when_bq_empty', exit_when_bq_empty, '@block_queue', @block_queue, 'now_menu', now_menu] if @debug
|
73
84
|
# self.imw_ins now_menu, 'now_menu'
|
74
85
|
|
75
86
|
break if exit_when_bq_empty && bq_is_empty? && !now_menu.prior_block_was_link
|
@@ -80,15 +91,11 @@ class InputSequencer
|
|
80
91
|
|
81
92
|
choice = run_yield :user_choice, &block
|
82
93
|
|
83
|
-
if choice.nil?
|
84
|
-
raise "Block not recognized."
|
85
|
-
break
|
86
|
-
end
|
94
|
+
raise 'Block not recognized.' if choice.nil?
|
87
95
|
break if run_yield(:exit?, choice&.downcase, &block) # Exit loop and method to terminate the app
|
88
96
|
|
89
97
|
next_state = run_yield :execute_block, choice, &block
|
90
98
|
# imw_ins next_state, 'next_state'
|
91
|
-
pp [__LINE__, 'next_state', next_state] if @debug
|
92
99
|
return :break if next_state == :break
|
93
100
|
|
94
101
|
next_menu = next_state
|
@@ -102,7 +109,6 @@ class InputSequencer
|
|
102
109
|
block_name = @block_queue.shift
|
103
110
|
end
|
104
111
|
# self.imw_ins block_name, 'block_name'
|
105
|
-
pp [__LINE__, 'block_name', block_name] if @debug
|
106
112
|
|
107
113
|
next_menu = if block_name == '.'
|
108
114
|
exit_when_bq_empty = false
|
@@ -112,15 +118,16 @@ class InputSequencer
|
|
112
118
|
state.display_menu = bq_is_empty?
|
113
119
|
state
|
114
120
|
end
|
115
|
-
pp [__LINE__, 'next_menu', next_menu] if @debug
|
116
121
|
next_menu
|
117
122
|
# imw_ins next_menu, 'next_menu'
|
118
123
|
end
|
119
124
|
now_menu = InputSequencer.merge_link_state(now_menu, next_menu)
|
120
125
|
end
|
126
|
+
# rubocop:disable Style/RescueStandardError
|
121
127
|
rescue
|
122
128
|
pp $!, $@
|
123
129
|
exit 1
|
130
|
+
# rubocop:enable Style/RescueStandardError
|
124
131
|
end
|
125
132
|
end
|
126
133
|
|
data/lib/markdown_exec.rb
CHANGED
@@ -9,6 +9,7 @@ require 'fileutils'
|
|
9
9
|
require 'open3'
|
10
10
|
require 'optparse'
|
11
11
|
require 'shellwords'
|
12
|
+
require 'time'
|
12
13
|
require 'tmpdir'
|
13
14
|
require 'tty-prompt'
|
14
15
|
require 'yaml'
|
@@ -17,6 +18,7 @@ require_relative 'ansi_formatter'
|
|
17
18
|
require_relative 'block_label'
|
18
19
|
require_relative 'cached_nested_file_reader'
|
19
20
|
require_relative 'cli'
|
21
|
+
require_relative 'color_scheme'
|
20
22
|
require_relative 'colorize'
|
21
23
|
require_relative 'directory_searcher'
|
22
24
|
require_relative 'env'
|
@@ -103,6 +105,81 @@ end
|
|
103
105
|
module MarkdownExec
|
104
106
|
include Exceptions
|
105
107
|
|
108
|
+
class FileInMenu
|
109
|
+
# Prepends the age of the file in days to the file name for display in a menu.
|
110
|
+
# @param filename [String] the name of the file
|
111
|
+
# @return [String] modified file name with age prepended
|
112
|
+
def self.for_menu(filename)
|
113
|
+
file_age = (Time.now - File.mtime(filename)) / (60 * 60 * 24 * 30)
|
114
|
+
filename = ColorScheme.colorize_path(filename)
|
115
|
+
|
116
|
+
" #{Histogram.display(file_age, 0, 11, 12, inverse: false)}: #{filename}"
|
117
|
+
end
|
118
|
+
|
119
|
+
# Removes the age from the string to retrieve the original file name.
|
120
|
+
# @param filename_with_age [String] the modified file name with age
|
121
|
+
# @return [String] the original file name
|
122
|
+
def self.from_menu(dname)
|
123
|
+
filename_with_age = dname.gsub(/\033\[[\d;]+m|\033\[0m/, '')
|
124
|
+
filename_with_age.split(': ', 2).last
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# A class that generates a histogram bar in terminal using xterm-256 color codes.
|
129
|
+
class Histogram
|
130
|
+
# Generates and prints a histogram bar for a given value within a specified range and width, with an option for inverse display.
|
131
|
+
# @param integer_value [Integer] the value to represent in the histogram
|
132
|
+
# @param min [Integer] the minimum value of the range
|
133
|
+
# @param max [Integer] the maximum value of the range
|
134
|
+
# @param width [Integer] the total width of the histogram in characters
|
135
|
+
# @param inverse [Boolean] whether the histogram is displayed in inverse order (right to left)
|
136
|
+
def self.display(integer_value, min, max, width, inverse: false)
|
137
|
+
return if max <= min # Ensure the range is valid
|
138
|
+
|
139
|
+
# Normalize the value within the range 0 to 1
|
140
|
+
normalized_value = [0, [(integer_value - min).to_f / (max - min), 1].min].max
|
141
|
+
|
142
|
+
# Calculate how many characters should be filled
|
143
|
+
filled_length = (normalized_value * width).round
|
144
|
+
|
145
|
+
# # Generate the histogram bar using xterm-256 colors (color code 42 is green)
|
146
|
+
# filled_bar = "\e[48;5;42m" + ' ' * filled_length + "\e[0m"
|
147
|
+
filled_bar = ('¤' * filled_length).fg_rgbh_AF_AF_00
|
148
|
+
empty_bar = ' ' * (width - filled_length)
|
149
|
+
|
150
|
+
# Determine the order of filled and empty parts based on the inverse flag
|
151
|
+
inverse ? (empty_bar + filled_bar) : (filled_bar + empty_bar)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
class MenuBuilder
|
156
|
+
def initialize
|
157
|
+
@chrome_color = :cyan
|
158
|
+
@o_color = :red
|
159
|
+
end
|
160
|
+
|
161
|
+
def build_menu(file_names, directory_names, found_in_block_names, files_in_directories, vbn)
|
162
|
+
choices = []
|
163
|
+
|
164
|
+
# Adding section title and data for file names
|
165
|
+
choices << { disabled: '', name: "in #{file_names[:section_title]}".send(@chrome_color) }
|
166
|
+
choices += file_names[:data].map { |str| FileInMenu.for_menu(str) }
|
167
|
+
|
168
|
+
# Conditionally add directory names if data is present
|
169
|
+
unless directory_names[:data].count.zero?
|
170
|
+
choices << { disabled: '', name: "in #{directory_names[:section_title]}".send(@chrome_color) }
|
171
|
+
choices += files_in_directories
|
172
|
+
end
|
173
|
+
|
174
|
+
# Adding found in block names
|
175
|
+
choices << { disabled: '', name: "in #{found_in_block_names[:section_title]}".send(@chrome_color) }
|
176
|
+
|
177
|
+
choices += vbn
|
178
|
+
|
179
|
+
choices
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
106
183
|
class SearchResultsReport < DirectorySearcher
|
107
184
|
def directory_names(search_options, highlight_value)
|
108
185
|
matched_directories = find_directory_names
|
@@ -113,20 +190,24 @@ module MarkdownExec
|
|
113
190
|
}
|
114
191
|
end
|
115
192
|
|
116
|
-
def
|
117
|
-
matched_contents = find_file_contents
|
118
|
-
|
193
|
+
def found_in_block_names(search_options, highlight_value, formspec: '=%<index>4.d: %<line>s')
|
194
|
+
matched_contents = (find_file_contents do |line|
|
195
|
+
read_block_name(line, search_options[:fenced_start_and_end_regex], search_options[:block_name_match], search_options[:block_name_nick_match])
|
196
|
+
end).map.with_index do |(file, contents), index|
|
197
|
+
# [file, contents.map { |detail| format(formspec, detail.index, detail.line) }, index]
|
198
|
+
[file, contents.map { |detail| format(formspec, { index: detail.index, line: detail.line }) }, index]
|
119
199
|
end
|
120
200
|
{
|
121
|
-
section_title: '
|
201
|
+
section_title: 'block names',
|
122
202
|
data: matched_contents.map(&:first),
|
123
203
|
formatted_text: matched_contents.map do |(file, details, index)|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
204
|
+
{ header: format('- %3.d: %s', index + 1, file),
|
205
|
+
content: AnsiFormatter.new(search_options).format_and_highlight_array(
|
206
|
+
details,
|
207
|
+
highlight: [highlight_value]
|
208
|
+
) }
|
209
|
+
end,
|
210
|
+
matched_contents: matched_contents
|
130
211
|
}
|
131
212
|
end
|
132
213
|
|
@@ -140,6 +221,21 @@ module MarkdownExec
|
|
140
221
|
).join("\n") }]
|
141
222
|
}
|
142
223
|
end
|
224
|
+
|
225
|
+
def read_block_name(line, fenced_start_and_end_regex, block_name_match, block_name_nick_match)
|
226
|
+
return unless line.match(fenced_start_and_end_regex)
|
227
|
+
|
228
|
+
bm = extract_named_captures_from_option(line, block_name_match)
|
229
|
+
return if bm.nil?
|
230
|
+
|
231
|
+
name = bm[:title]
|
232
|
+
|
233
|
+
if block_name_nick_match.present? && line =~ Regexp.new(block_name_nick_match)
|
234
|
+
$~[0]
|
235
|
+
else
|
236
|
+
bm && bm[1] ? bm[:title] : name
|
237
|
+
end
|
238
|
+
end
|
143
239
|
end
|
144
240
|
|
145
241
|
##
|
@@ -248,7 +344,14 @@ module MarkdownExec
|
|
248
344
|
# Reports and executes block logic
|
249
345
|
def execute_block_logic(files)
|
250
346
|
@options[:filename] = select_document_if_multiple(files)
|
251
|
-
@options.
|
347
|
+
@options.document_inpseq
|
348
|
+
rescue StandardError
|
349
|
+
error_handler('execute_block_logic')
|
350
|
+
# rubocop:disable Style/RescueStandardError
|
351
|
+
rescue
|
352
|
+
pp $!, $@
|
353
|
+
exit 1
|
354
|
+
# rubocop:enable Style/RescueStandardError
|
252
355
|
end
|
253
356
|
|
254
357
|
## Executes the block specified in the options
|
@@ -353,16 +456,17 @@ module MarkdownExec
|
|
353
456
|
:menu_chrome_color)}"
|
354
457
|
searcher = SearchResultsReport.new(value, [find_path])
|
355
458
|
file_names = searcher.file_names(options, value)
|
356
|
-
|
459
|
+
found_in_block_names = searcher.found_in_block_names(options, value, formspec: '%<line>s')
|
357
460
|
directory_names = searcher.directory_names(options, value)
|
358
461
|
|
359
462
|
### search in file contents (block names, chrome, or text)
|
360
|
-
[
|
463
|
+
[found_in_block_names,
|
361
464
|
directory_names,
|
362
465
|
file_names].each do |data|
|
363
|
-
|
466
|
+
next if data[:data].count.zero?
|
364
467
|
next unless data[:formatted_text]
|
365
468
|
|
469
|
+
@fout.fout "In #{data[:section_title]}" if data[:section_title]
|
366
470
|
data[:formatted_text].each do |fi|
|
367
471
|
@fout.fout fi[:header] if fi[:header]
|
368
472
|
@fout.fout fi[:content] if fi[:content]
|
@@ -372,17 +476,29 @@ module MarkdownExec
|
|
372
476
|
|
373
477
|
## pick a document to open
|
374
478
|
#
|
375
|
-
|
479
|
+
files_in_directories = directory_names[:data].map do |dn|
|
376
480
|
find_files('*', [dn], exclude_dirs: true)
|
377
|
-
end.flatten(1)
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
481
|
+
end.flatten(1).map { |str| FileInMenu.for_menu(str) }
|
482
|
+
|
483
|
+
return { exit: true } unless file_names[:data]&.count.positive? || files_in_directories&.count.positive? || found_in_block_names[:data]&.count.positive?
|
484
|
+
|
485
|
+
vbn = found_in_block_names[:matched_contents].map do |matched_contents|
|
486
|
+
filename, details, = matched_contents
|
487
|
+
nexo = AnsiFormatter.new(@options).format_and_highlight_array(
|
488
|
+
details,
|
489
|
+
highlight: [value]
|
490
|
+
)
|
491
|
+
[FileInMenu.for_menu(filename)] + nexo.map { |str| { disabled: '', name: (' ' * 20) + str } }
|
492
|
+
end.flatten
|
493
|
+
|
494
|
+
choices = MenuBuilder.new.build_menu(file_names, directory_names, found_in_block_names, files_in_directories, vbn)
|
495
|
+
|
496
|
+
@options[:filename] = FileInMenu.from_menu(
|
497
|
+
select_document_if_multiple(
|
498
|
+
choices,
|
499
|
+
prompt: options[:prompt_select_md].to_s + ' ¤ Age in months'.fg_rgbh_AF_AF_00
|
500
|
+
)
|
501
|
+
)
|
386
502
|
{ exit: false }
|
387
503
|
end
|
388
504
|
|
@@ -400,7 +516,7 @@ module MarkdownExec
|
|
400
516
|
opts.banner = [
|
401
517
|
"#{MarkdownExec::APP_NAME}" \
|
402
518
|
" - #{MarkdownExec::APP_DESC} (#{MarkdownExec::VERSION})",
|
403
|
-
"Usage: #{executable_name} [(
|
519
|
+
"Usage: #{executable_name} [(directory | file [block_name] | search_keyword)] [options]"
|
404
520
|
].join("\n")
|
405
521
|
|
406
522
|
menu_iter do |item|
|
@@ -447,7 +563,7 @@ module MarkdownExec
|
|
447
563
|
}
|
448
564
|
when 'show_config'
|
449
565
|
->(_) {
|
450
|
-
finalize_cli_argument_processing(
|
566
|
+
finalize_cli_argument_processing([])
|
451
567
|
@fout.fout options.sort_by_key.to_yaml
|
452
568
|
}
|
453
569
|
when 'val_as_bool'
|
@@ -604,7 +720,7 @@ module MarkdownExec
|
|
604
720
|
|
605
721
|
saved_name_split filename
|
606
722
|
@options[:save_executed_script] = false
|
607
|
-
@options.
|
723
|
+
@options.document_inpseq
|
608
724
|
rescue StandardError
|
609
725
|
error_handler('run_last_script')
|
610
726
|
end
|
@@ -618,13 +734,13 @@ module MarkdownExec
|
|
618
734
|
@options[:saved_filename_replacement])
|
619
735
|
end
|
620
736
|
|
621
|
-
def select_document_if_multiple(files = list_markdown_files_in_path)
|
737
|
+
def select_document_if_multiple(files = list_markdown_files_in_path, prompt: options[:prompt_select_md].to_s)
|
622
738
|
return files[0] if (count = files.count) == 1
|
623
739
|
|
624
740
|
return unless count >= 2
|
625
741
|
|
626
742
|
opts = options.dup
|
627
|
-
select_option_or_exit(HashDelegator.new(@options).string_send_color(
|
743
|
+
select_option_or_exit(HashDelegator.new(@options).string_send_color(prompt, :prompt_color_after_script_execution),
|
628
744
|
files,
|
629
745
|
opts.merge(per_page: opts[:select_page_height]))
|
630
746
|
end
|
@@ -633,7 +749,6 @@ module MarkdownExec
|
|
633
749
|
def select_option_or_exit(prompt_text, strings, opts = {})
|
634
750
|
result = @options.select_option_with_metadata(prompt_text, strings,
|
635
751
|
opts)
|
636
|
-
### 2024-04-20 what for?
|
637
752
|
# return unless result.fetch(:option, nil)
|
638
753
|
|
639
754
|
result[:selected]
|
@@ -670,7 +785,7 @@ module MarkdownExec
|
|
670
785
|
|
671
786
|
saved_name_split(filename)
|
672
787
|
|
673
|
-
@options.
|
788
|
+
@options.document_inpseq ### ({ save_executed_script: false })
|
674
789
|
end
|
675
790
|
|
676
791
|
public
|
data/lib/menu.src.yml
CHANGED
@@ -106,28 +106,38 @@
|
|
106
106
|
:opt_name: display_level_xbase_prefix
|
107
107
|
:procname: val_as_str
|
108
108
|
|
109
|
-
# - :default: "(document_link)"
|
110
|
-
# :description: Name of Link block to load with the document
|
111
|
-
# :env_var: MDE_DOCUMENT_LOAD_LINK_BLOCK_NAME
|
112
|
-
# :opt_name: document_load_link_block_name
|
113
|
-
# :procname: val_as_str
|
114
|
-
|
115
109
|
- :default: "(document_options)"
|
116
110
|
:description: Name of Opts block to load with the document
|
117
111
|
:env_var: MDE_DOCUMENT_LOAD_OPTS_BLOCK_NAME
|
118
112
|
:opt_name: document_load_opts_block_name
|
119
113
|
:procname: val_as_str
|
120
114
|
|
115
|
+
- :arg_name: GLOB
|
116
|
+
:default: "document_configurations/%{document_filename}_*.sh"
|
117
|
+
:description: Glob for saved lines for a document
|
118
|
+
:env_var: MDE_DOCUMENT_SAVED_LINES_GLOB
|
119
|
+
:opt_name: document_saved_lines_glob
|
120
|
+
:procname: val_as_str
|
121
|
+
|
122
|
+
- :arg_name: BOOL
|
123
|
+
:default: true
|
124
|
+
:description: Add menu options for saved lines
|
125
|
+
:env_var: MDE_MENU_FOR_SAVED_LINES
|
126
|
+
:opt_name: menu_for_saved_lines
|
127
|
+
:procname: val_as_bool
|
128
|
+
|
121
129
|
- :arg_name: BOOL
|
122
130
|
:default: false
|
123
131
|
:description: Dump @delegate_object
|
124
|
-
:
|
132
|
+
:env_var: MDE_DUMP_DELEGATE_OBJECT
|
133
|
+
:long_name: dump-delegate-object
|
125
134
|
:opt_name: dump_delegate_object
|
126
135
|
:procname: val_as_bool
|
127
136
|
|
128
137
|
- :arg_name: BOOL
|
129
138
|
:default: false
|
130
139
|
:description: Dump BlocksInFile (stage 1)
|
140
|
+
:env_var: MDE_DUMP_BLOCKS_IN_FILE
|
131
141
|
:long_name: dump-blocks-in-file
|
132
142
|
:opt_name: dump_blocks_in_file
|
133
143
|
:procname: val_as_bool
|
@@ -135,27 +145,31 @@
|
|
135
145
|
- :arg_name: BOOL
|
136
146
|
:default: false
|
137
147
|
:description: Dump inherited block_names
|
138
|
-
:
|
148
|
+
:env_var: MDE_DUMP_INHERITED_BLOCK_NAMES
|
149
|
+
:long_name: dump-inherited-block_names
|
139
150
|
:opt_name: dump_inherited_block_names
|
140
151
|
:procname: val_as_bool
|
141
152
|
|
142
153
|
- :arg_name: BOOL
|
143
154
|
:default: false
|
144
155
|
:description: Dump inherited dependencies
|
145
|
-
:
|
156
|
+
:env_var: MDE_DUMP_INHERITED_DEPENDENCIES
|
157
|
+
:long_name: dump-inherited-dependencies
|
146
158
|
:opt_name: dump_inherited_dependencies
|
147
159
|
:procname: val_as_bool
|
148
160
|
|
149
161
|
- :arg_name: BOOL
|
150
162
|
:default: false
|
151
163
|
:description: Dump inherited lines
|
152
|
-
:
|
164
|
+
:env_var: MDE_DUMP_INHERITED_LINES
|
165
|
+
:long_name: dump-inherited-lines
|
153
166
|
:opt_name: dump_inherited_lines
|
154
167
|
:procname: val_as_bool
|
155
168
|
|
156
169
|
- :arg_name: BOOL
|
157
170
|
:default: false
|
158
171
|
:description: Dump MenuBlocks (stage 2)
|
172
|
+
:env_var: MDE_DUMP_MENU_BLOCKS
|
159
173
|
:long_name: dump-menu-blocks
|
160
174
|
:opt_name: dump_menu_blocks
|
161
175
|
:procname: val_as_bool
|
@@ -163,6 +177,7 @@
|
|
163
177
|
- :arg_name: BOOL
|
164
178
|
:default: false
|
165
179
|
:description: Dump selected block
|
180
|
+
:env_var: MDE_DUMP_SELECTED_BLOCK
|
166
181
|
:long_name: dump-selected-block
|
167
182
|
:opt_name: dump_selected_block
|
168
183
|
:procname: val_as_bool
|
@@ -212,8 +227,6 @@
|
|
212
227
|
:opt_name: exclude_expect_blocks
|
213
228
|
:procname: val_as_bool
|
214
229
|
|
215
|
-
# - :default: >
|
216
|
-
# osascript scripts/applescript/mde.applescript "%{batch_index}" "%{home}" " %{started_at} - %{document_filename} - %{block_name} " "%{script_filespec}" "%{output_filespec}"
|
217
230
|
- :default: >
|
218
231
|
osascript -e '
|
219
232
|
on run argv
|
@@ -285,7 +298,7 @@
|
|
285
298
|
:opt_name: fenced_start_and_end_regex
|
286
299
|
:procname: val_as_str
|
287
300
|
|
288
|
-
- :default: "^(?<indent> *)`{3,}(?<shell>[^`\\s]*)
|
301
|
+
- :default: "^(?<indent> *)`{3,}(?<shell>[^`\\s]*) *(:(?<name>[^\\s]*))? *(?<rest>.*) *$"
|
289
302
|
:description: Match the start of a fenced block
|
290
303
|
:env_var: MDE_FENCED_START_EXTENDED_REGEX
|
291
304
|
:opt_name: fenced_start_extended_regex
|
@@ -407,6 +420,14 @@
|
|
407
420
|
:opt_name: list_recent_scripts
|
408
421
|
:procname: val_as_bool
|
409
422
|
|
423
|
+
- :arg_name: PATH
|
424
|
+
:default: ''
|
425
|
+
:description: Load code
|
426
|
+
:env_var: MDE_LOAD_CODE
|
427
|
+
:long_name: load-code
|
428
|
+
:opt_name: load_code
|
429
|
+
:procname: val_as_str
|
430
|
+
|
410
431
|
- :arg_name: PREFIX
|
411
432
|
:default: mde
|
412
433
|
:description: Name prefix for stdout files
|
@@ -494,6 +515,13 @@
|
|
494
515
|
:opt_name: menu_exit_at_top
|
495
516
|
:procname: val_as_bool
|
496
517
|
|
518
|
+
- :arg_name: BOOL
|
519
|
+
:default: false
|
520
|
+
:description: Display Load option at top of menu (vs bottom)
|
521
|
+
:env_var: MDE_MENU_LOAD_AT_TOP
|
522
|
+
:opt_name: menu_load_at_top
|
523
|
+
:procname: val_as_bool
|
524
|
+
|
497
525
|
- :default:
|
498
526
|
:line: "~~~"
|
499
527
|
:description: closing demarcations for menu
|
@@ -622,6 +650,13 @@
|
|
622
650
|
:opt_name: menu_option_back_name
|
623
651
|
:procname: val_as_str
|
624
652
|
|
653
|
+
- :default:
|
654
|
+
:line: "* Edit"
|
655
|
+
:description: Text for Edit option
|
656
|
+
:env_var: MDE_MENU_OPTION_EDIT_NAME
|
657
|
+
:opt_name: menu_option_edit_name
|
658
|
+
:procname: val_as_str
|
659
|
+
|
625
660
|
- :default:
|
626
661
|
:line: "* Exit"
|
627
662
|
:description: Text for Exit option
|
@@ -629,6 +664,27 @@
|
|
629
664
|
:opt_name: menu_option_exit_name
|
630
665
|
:procname: val_as_str
|
631
666
|
|
667
|
+
- :default:
|
668
|
+
:line: "* Load"
|
669
|
+
:description: Text for Load option
|
670
|
+
:env_var: MDE_MENU_OPTION_LOAD_NAME
|
671
|
+
:opt_name: menu_option_load_name
|
672
|
+
:procname: val_as_str
|
673
|
+
|
674
|
+
- :default:
|
675
|
+
:line: "* Save"
|
676
|
+
:description: Text for Save option
|
677
|
+
:env_var: MDE_MENU_OPTION_SAVE_NAME
|
678
|
+
:opt_name: menu_option_save_name
|
679
|
+
:procname: val_as_str
|
680
|
+
|
681
|
+
- :default:
|
682
|
+
:line: "* View"
|
683
|
+
:description: Text for View option
|
684
|
+
:env_var: MDE_MENU_OPTION_VIEW_NAME
|
685
|
+
:opt_name: menu_option_view_name
|
686
|
+
:procname: val_as_str
|
687
|
+
|
632
688
|
- :default: fg_rgbh_ff_00_ff
|
633
689
|
:description: Color of menu opts
|
634
690
|
:env_var: MDE_MENU_OPTS_COLOR
|
@@ -710,7 +766,7 @@
|
|
710
766
|
:procname: val_as_bool
|
711
767
|
|
712
768
|
- :arg_name: BOOL
|
713
|
-
:default:
|
769
|
+
:default: false
|
714
770
|
:description: Display inherited lines in menu
|
715
771
|
:env_var: MDE_MENU_WITH_INHERITED_LINES
|
716
772
|
:opt_name: menu_with_inherited_lines
|
@@ -758,7 +814,6 @@
|
|
758
814
|
:default: false
|
759
815
|
:description: Display summary for execution
|
760
816
|
:env_var: MDE_OUTPUT_EXECUTION_SUMMARY
|
761
|
-
:long_name: output-execution-summary
|
762
817
|
:opt_name: output_execution_summary
|
763
818
|
:procname: val_as_bool
|
764
819
|
|
@@ -860,6 +915,12 @@
|
|
860
915
|
:opt_name: prompt_exit
|
861
916
|
:procname: val_as_str
|
862
917
|
|
918
|
+
- :default: Back
|
919
|
+
:description: Quit prompt
|
920
|
+
:env_var: MDE_PROMPT_FILESPEC_OTHER
|
921
|
+
:opt_name: prompt_filespec_back
|
922
|
+
:procname: val_as_str
|
923
|
+
|
863
924
|
- :default: Other
|
864
925
|
:description: Prompt for a custom file name
|
865
926
|
:env_var: MDE_PROMPT_FILESPEC_OTHER
|
@@ -946,7 +1007,6 @@
|
|
946
1007
|
:default: false
|
947
1008
|
:description: Wheter to save an executed script`
|
948
1009
|
:env_var: MDE_SAVE_EXECUTED_SCRIPT
|
949
|
-
:long_name: save-executed-script
|
950
1010
|
:opt_name: save_executed_script
|
951
1011
|
:procname: val_as_bool
|
952
1012
|
|
@@ -954,7 +1014,6 @@
|
|
954
1014
|
:default: false
|
955
1015
|
:description: Save standard output of the executed script
|
956
1016
|
:env_var: MDE_SAVE_EXECUTION_OUTPUT
|
957
|
-
:long_name: save-execution-output
|
958
1017
|
:opt_name: save_execution_output
|
959
1018
|
:procname: val_as_bool
|
960
1019
|
|
@@ -988,7 +1047,6 @@
|
|
988
1047
|
:default: logs
|
989
1048
|
:description: Folder where saved scripts are stored
|
990
1049
|
:env_var: MDE_SAVED_SCRIPT_FOLDER
|
991
|
-
:long_name: saved-script-folder
|
992
1050
|
:opt_name: saved_script_folder
|
993
1051
|
:procname: val_as_str
|
994
1052
|
|
@@ -1003,7 +1061,6 @@
|
|
1003
1061
|
:default: logs
|
1004
1062
|
:description: Saved stdout folder
|
1005
1063
|
:env_var: MDE_SAVED_STDOUT_FOLDER
|
1006
|
-
:long_name: saved-stdout-folder
|
1007
1064
|
:opt_name: saved_stdout_folder
|
1008
1065
|
:procname: val_as_str
|
1009
1066
|
|