markdown_exec 1.8.9 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,229 @@
1
+ #!/usr/bin/env bundle exec ruby
2
+ # frozen_string_literal: true
3
+
4
+ # encoding=utf-8
5
+
6
+ # require_relative 'dev/instance_method_wrapper' # for ImwUx
7
+ require_relative 'env'
8
+ require_relative 'link_history'
9
+
10
+ # InputSequencer manages the sequence of menu interactions and block executions based on user input.
11
+ class InputSequencer
12
+ # extend ImwUx # This makes imw_indent available as a class method
13
+ # include ImwUx # This makes imw_indent available as a class method
14
+
15
+ # self.prepend InstanceMethodWrapper # traps initialize as well
16
+ attr_reader :document_filename, :current_block, :block_queue
17
+
18
+ def initialize(document_filename, initial_blocks = nil)
19
+ @document_filename = document_filename
20
+ @current_block = nil
21
+ @block_queue = initial_blocks
22
+ @debug = Env::env_bool('INPUT_SEQUENCER_DEBUG', default: false) ### false e
23
+ end
24
+
25
+ # Merges the current menu state with the next, prioritizing the next state's values.
26
+ def self.merge_link_state(current, next_state)
27
+ MarkdownExec::LinkState.new(
28
+ block_name: next_state.block_name,
29
+ display_menu: next_state.display_menu.nil? ? current.display_menu : next_state.display_menu,
30
+ document_filename: next_state.document_filename || current.document_filename,
31
+ inherited_block_names: next_state.inherited_block_names,
32
+ inherited_dependencies: next_state.inherited_dependencies,
33
+ inherited_lines: next_state.inherited_lines,
34
+ prior_block_was_link: next_state.prior_block_was_link.nil? ? current.prior_block_was_link : next_state.prior_block_was_link
35
+ )
36
+ rescue
37
+ binding.irb
38
+ end
39
+
40
+ # Generates the next menu state based on provided attributes.
41
+
42
+ def self.next_link_state(block_name: nil, display_menu: nil, document_filename: nil, prior_block_was_link: false)
43
+ MarkdownExec::LinkState.new(
44
+ block_name: block_name,
45
+ display_menu: display_menu,
46
+ document_filename: document_filename,
47
+ prior_block_was_link: prior_block_was_link
48
+ )
49
+ end
50
+
51
+ # Orchestrates the flow of menu states and user interactions.
52
+ def run_yield(sym, *args, &block)
53
+ block.call sym, *args
54
+ end
55
+
56
+ def bq_is_empty?
57
+ !@block_queue || @block_queue.empty?
58
+ end
59
+
60
+ # Orchestrates the flow of menu states and user interactions.
61
+ def run(&block)
62
+ now_menu = InputSequencer.next_link_state(
63
+ display_menu: bq_is_empty?,
64
+ document_filename: @document_filename,
65
+ prior_block_was_link: false # true bypass_exit when last block was a link (from cli)
66
+ )
67
+ exit_when_bq_empty = !bq_is_empty? # true when running blocks from cli; unless "stay" is used
68
+ loop do
69
+ break if run_yield(:parse_document, now_menu.document_filename, &block) == :break
70
+
71
+ pp [__LINE__, 'exit_when_bq_empty', exit_when_bq_empty, '@block_queue', @block_queue, 'now_menu', now_menu] if @debug
72
+ # self.imw_ins now_menu, 'now_menu'
73
+
74
+ break if exit_when_bq_empty && bq_is_empty? && !now_menu.prior_block_was_link
75
+
76
+ if now_menu.display_menu
77
+ exit_when_bq_empty = false
78
+
79
+ run_yield :display_menu, &block
80
+
81
+ choice = run_yield :user_choice, &block
82
+
83
+ break if run_yield(:exit?, choice&.downcase, &block) # Exit loop and method to terminate the app
84
+
85
+ next_state = run_yield :execute_block, choice, &block
86
+ # imw_ins next_state, 'next_state'
87
+ pp [__LINE__, 'next_state', next_state] if @debug
88
+ return :break if next_state == :break
89
+
90
+ next_menu = next_state
91
+
92
+ else
93
+ if now_menu.block_name && !now_menu.block_name.empty?
94
+ block_name = now_menu.block_name
95
+ else
96
+ break if bq_is_empty? # Exit loop if no more blocks to process
97
+
98
+ block_name = @block_queue.shift
99
+ end
100
+ # self.imw_ins block_name, 'block_name'
101
+ pp [__LINE__, 'block_name', block_name] if @debug
102
+
103
+ next_menu = if block_name == '.'
104
+ exit_when_bq_empty = false
105
+ InputSequencer.next_link_state(display_menu: true)
106
+ else
107
+ state = run_yield :execute_block, block_name, &block
108
+ state.display_menu = bq_is_empty?
109
+ state
110
+ end
111
+ pp [__LINE__, 'next_menu', next_menu] if @debug
112
+ next_menu
113
+ # imw_ins next_menu, 'next_menu'
114
+ end
115
+ now_menu = InputSequencer.merge_link_state(now_menu, next_menu)
116
+ end
117
+ rescue
118
+ binding.irb
119
+ end
120
+ end
121
+
122
+ return if __FILE__ != $PROGRAM_NAME
123
+
124
+ $doc1 = {
125
+ 'b1' => 'Content of bash1',
126
+ 'b2' => 'Content of bash2',
127
+ 'b3' => 'Content of bash3',
128
+ 'l1' => { 'block_name' => 'b1', 'document_filename' => 'd1' },
129
+ 'l2' => { 'block_name' => 'b2', 'document_filename' => 'd2' },
130
+ 'l3' => { 'block_name' => 'b3' }
131
+ }.freeze
132
+ $stay = '.' # keep menu open (from command line)
133
+ $texit = 'x'
134
+
135
+ class MDE
136
+ # extend ImwUx # This makes imw_indent available as a class method
137
+ # include ImwUx # This makes imw_indent available as a class method
138
+
139
+ def initialize(document_filename, initial_blocks = [])
140
+ @inpseq = InputSequencer.new(document_filename, initial_blocks)
141
+ end
142
+
143
+ def do_run
144
+ @inpseq.run do |msg, data|
145
+ case msg
146
+ when :parse_document # once for each menu
147
+ # self.imw_ins data, '@ - parse document'
148
+ parse_document(data)
149
+ when :display_menu
150
+ puts "? - Select a block to execute (or type #{$texit} to exit):"
151
+ puts "doc: #{@document_filename}"
152
+ display_menu
153
+ when :user_choice
154
+ $stdin.gets.chomp
155
+ when :execute_block
156
+ # self.imw_ins data, "! - Executing block"
157
+ execute_block(data)
158
+ when :exit?
159
+ data == $texit
160
+ when :stay?
161
+ data == $stay
162
+ else
163
+ raise "Invalid message: #{msg}"
164
+ end
165
+ end
166
+ end
167
+
168
+ private
169
+
170
+ def display_menu
171
+ @blocks.each_key { |block| puts block }
172
+ puts $texit
173
+ end
174
+
175
+ def execute_block(block_name)
176
+ content = @blocks[block_name]
177
+ if content
178
+ puts content
179
+ if block_name.start_with?('l')
180
+ interpret_link_block(content)
181
+ else
182
+ InputSequencer.next_link_state
183
+ end
184
+ else
185
+ puts "! - Block not found: #{block_name}"
186
+ InputSequencer.next_link_state
187
+ end
188
+ end
189
+
190
+ def interpret_link_block(content)
191
+ # Stub: Interpret a "Link" block, extracting directives for the next action
192
+ # In a real implementation, this would parse the content for next block or document
193
+ puts "! - Interpreting Link block: #{content}"
194
+ InputSequencer.next_link_state(
195
+ block_name: content.fetch('block_name', nil),
196
+ document_filename: content.fetch('document_filename', nil),
197
+ prior_block_was_link: true
198
+ )
199
+ end
200
+
201
+ def load_document(_name)
202
+ # Stub: Load and return the content of the document
203
+ # In a real implementation, this would read the file and return its content
204
+ # "Block 1: Content of block 1\nBlock 2: Content of block 2\nLink: block_name 3, document_filename doc2"
205
+ $doc1.map { |key, value| "#{key}: #{value}" }.join("\n")
206
+ end
207
+
208
+ def parse_document(data)
209
+ load_document(data)
210
+ # Stub: Parse document content into blocks
211
+ # In a real implementation, this would split the document into named blocks
212
+ @blocks = $doc1
213
+ end
214
+ end
215
+ # MDE.singleton_class.prepend(ImwUx)
216
+ # MDE.prepend(ImwUx)
217
+
218
+ def main
219
+ if ARGV.empty?
220
+ puts "Usage: #{__FILE__} document_filename [block_name...]"
221
+ exit(1)
222
+ end
223
+ document_filename = ARGV.shift
224
+ initial_blocks = ARGV
225
+ mde = MDE.new(document_filename, initial_blocks)
226
+ mde.do_run
227
+ end
228
+
229
+ main
data/lib/link_history.rb CHANGED
@@ -4,8 +4,9 @@
4
4
  # encoding=utf-8
5
5
  module MarkdownExec
6
6
  class LinkState
7
- attr_accessor :block_name, :document_filename,
8
- :inherited_block_names, :inherited_dependencies, :inherited_lines
7
+ attr_accessor :block_name, :display_menu, :document_filename,
8
+ :inherited_block_names, :inherited_dependencies, :inherited_lines,
9
+ :prior_block_was_link
9
10
 
10
11
  # Initialize the LinkState with keyword arguments for each attribute.
11
12
  # @param block_name [String, nil] the name of the block.
@@ -13,13 +14,16 @@ module MarkdownExec
13
14
  # @param inherited_block_names [Array<String>, nil] the names of the inherited blocks.
14
15
  # @param inherited_dependencies [?, nil] the dependecy hierarcy.
15
16
  # @param inherited_lines [Array<String>, nil] the inherited lines of code.
16
- def initialize(block_name: nil, document_filename: nil,
17
- inherited_block_names: [], inherited_dependencies: nil, inherited_lines: nil)
17
+ def initialize(block_name: nil, display_menu: nil, document_filename: nil,
18
+ inherited_block_names: [], inherited_dependencies: nil, inherited_lines: nil,
19
+ prior_block_was_link: nil)
18
20
  @block_name = block_name
21
+ @display_menu = display_menu
19
22
  @document_filename = document_filename
20
23
  @inherited_block_names = inherited_block_names
21
24
  @inherited_dependencies = inherited_dependencies
22
25
  @inherited_lines = inherited_lines
26
+ @prior_block_was_link = prior_block_was_link
23
27
  end
24
28
 
25
29
  # Creates an empty LinkState instance.
@@ -34,10 +38,12 @@ module MarkdownExec
34
38
  def ==(other)
35
39
  other.class == self.class &&
36
40
  other.block_name == block_name &&
41
+ other.display_menu == display_menu &&
37
42
  other.document_filename == document_filename &&
38
43
  other.inherited_block_names == inherited_block_names &&
39
44
  other.inherited_dependencies == inherited_dependencies &&
40
- other.inherited_lines == inherited_lines
45
+ other.inherited_lines == inherited_lines &&
46
+ other.prior_block_was_link == prior_block_was_link
41
47
  end
42
48
  end
43
49
 
@@ -7,5 +7,5 @@ module MarkdownExec
7
7
  BIN_NAME = 'mde'
8
8
  GEM_NAME = 'markdown_exec'
9
9
  TAP_DEBUG = 'MDE_DEBUG'
10
- VERSION = '1.8.9'
10
+ VERSION = '2.0.1'
11
11
  end
data/lib/markdown_exec.rb CHANGED
@@ -10,6 +10,7 @@ require 'open3'
10
10
  require 'optparse'
11
11
  require 'shellwords'
12
12
  require 'tmpdir'
13
+ # require 'tty-file'
13
14
  require 'tty-prompt'
14
15
  require 'yaml'
15
16
 
@@ -25,6 +26,7 @@ require_relative 'fcb'
25
26
  require_relative 'filter'
26
27
  require_relative 'fout'
27
28
  require_relative 'hash_delegator'
29
+ require_relative 'input_sequencer'
28
30
  require_relative 'markdown_exec/version'
29
31
  require_relative 'mdoc'
30
32
  require_relative 'option_value'
@@ -103,7 +105,6 @@ module MarkdownExec
103
105
 
104
106
  ##
105
107
  #
106
- # rubocop:disable Layout/LineLength
107
108
  # :reek:DuplicateMethodCall { allow_calls: ['block', 'item', 'lm', 'opts', 'option', '@options', 'required_blocks'] }
108
109
  # rubocop:enable Layout/LineLength
109
110
  # :reek:MissingSafeMethod { exclude: [ read_configuration_file! ] }
@@ -293,15 +294,12 @@ module MarkdownExec
293
294
 
294
295
  ## position 1: block name (optional)
295
296
  #
296
- block_name = rest.shift
297
- @options[:block_name] = block_name if block_name.present?
297
+ @options[:block_name] = nil
298
298
  @options[:input_cli_rest] = @rest
299
299
  rescue FileMissingError
300
300
  warn_format('finalize_cli_argument_processing',
301
301
  "File missing -- #{$!}", { abort: true })
302
- # @options[:block_name] = ''
303
- # @options[:filename] = ''
304
- # exit 1
302
+ exit 1
305
303
  rescue StandardError
306
304
  error_handler('finalize_cli_argument_processing')
307
305
  end
data/lib/mdoc.rb CHANGED
@@ -70,10 +70,10 @@ module MarkdownExec
70
70
  # @param name [String] The name of the code block to start the retrieval from.
71
71
  # @return [Array<Hash>] An array of code blocks required by the specified code block.
72
72
  #
73
- def collect_block_dependencies(name)
74
- name_block = get_block_by_anyname(name)
73
+ def collect_block_dependencies(anyname:)
74
+ name_block = get_block_by_anyname(anyname)
75
75
  if name_block.nil? || name_block.keys.empty?
76
- raise "Named code block `#{name}` not found. (@#{__LINE__})"
76
+ raise "Named code block `#{anyname}` not found. (@#{__LINE__})"
77
77
  end
78
78
 
79
79
  nickname = name_block[:nickname] || name_block[:oname]
@@ -116,9 +116,9 @@ module MarkdownExec
116
116
  # @param name [String] The name of the code block to start the collection from.
117
117
  # @return [Array<String>] An array of strings containing the collected code blocks.
118
118
  #
119
- def collect_recursively_required_code(name, block_source:, label_body: true, label_format_above: nil,
119
+ def collect_recursively_required_code(anyname:, block_source:, label_body: true, label_format_above: nil,
120
120
  label_format_below: nil)
121
- block_search = collect_block_dependencies(name)
121
+ block_search = collect_block_dependencies(anyname: anyname)
122
122
  if block_search[:blocks]
123
123
  blocks = collect_wrapped_blocks(block_search[:blocks])
124
124
  # &bc 'blocks.count:',blocks.count
@@ -453,12 +453,12 @@ if $PROGRAM_NAME == __FILE__
453
453
 
454
454
  ### broken test
455
455
  def test_collect_block_dependencies
456
- result = @doc.collect_block_dependencies('block3')[:blocks]
456
+ result = @doc.collect_block_dependencies(anyname: 'block3')[:blocks]
457
457
  expected_result = [@table[0], @table[1], @table[2]]
458
458
  assert_equal expected_result, result
459
459
 
460
460
  assert_raises(RuntimeError) do
461
- @doc.collect_block_dependencies('missing_block')
461
+ @doc.collect_block_dependencies(anyname: 'missing_block')
462
462
  end
463
463
  end
464
464
 
data/lib/menu.src.yml CHANGED
@@ -121,6 +121,22 @@
121
121
  :opt_name: dump_blocks_in_file
122
122
  :procname: val_as_bool
123
123
 
124
+ - :arg_name: BOOL
125
+ :default: false
126
+ :description: Dump inherited block_names
127
+ :env_var: MDE_DUMP_INHERITED_BLOCK_NAMES
128
+ :long_name: dump-dump-inherited-block_names
129
+ :opt_name: dump_inherited_block_names
130
+ :procname: val_as_bool
131
+
132
+ - :arg_name: BOOL
133
+ :default: false
134
+ :description: Dump inherited dependencies
135
+ :env_var: MDE_DUMP_INHERITED_DEPENDENCIES
136
+ :long_name: dump-dump-inherited-dependencies
137
+ :opt_name: dump_inherited_dependencies
138
+ :procname: val_as_bool
139
+
124
140
  - :arg_name: BOOL
125
141
  :default: false
126
142
  :description: Dump inherited lines
@@ -203,7 +219,7 @@
203
219
  end tell
204
220
 
205
221
  set winHeight to (screenHeight * 2 / 3)
206
- set winWidth to (screenWidth / 2)
222
+ set winWidth to (screenWidth * 2 / 3)
207
223
  set xoff to menubarHeight * %{batch_index}
208
224
  set yoff to xoff mod (screenHeight - winHeight)
209
225
 
@@ -211,11 +227,11 @@
211
227
  tell the first window
212
228
  set bounds to {xoff, yoff, xoff + winWidth, yoff + winHeight}
213
229
  tell the current session
214
- write text "# %{script_filespec}"
215
- write text "# %{output_filespec}"
216
- write text "echo -ne \"\\033]; %{started_at} - %{document_filename} - %{block_name} \\007\""
230
+ write text "s=\"%{script_filespec}\""
231
+ write text "o=\"%{output_filespec}\""
217
232
  write text "cd \"%{home}\""
218
- write text "\"%{script_filename}\" | tee \"%{output_filespec}\""
233
+ write text "echo -ne \"\\033]; %{started_at} - %{document_filename} - %{block_name} \\007\""
234
+ write text "\"$s\" | tee -a \"$o\""
219
235
  end tell
220
236
  end tell
221
237
  end tell'
@@ -591,9 +607,8 @@
591
607
  :opt_name: menu_note_format
592
608
  :procname: val_as_str
593
609
 
594
- ## all non-blank lines are notes
595
- #
596
- - :default: "^(?<line>.*?) *$"
610
+ ## all lines that do not start with "/ " are notes
611
+ - :default: "^(?<line>(?!/ ).*)?$"
597
612
  :description: Pattern for notes in block selection menu
598
613
  :env_var: MDE_MENU_NOTE_MATCH
599
614
  :opt_name: menu_note_match
@@ -712,21 +727,25 @@
712
727
  :env_var: MDE_OUTPUT_ASSIGNMENT_BEGIN
713
728
  :opt_name: output_assignment_begin
714
729
  :procname: val_as_str
730
+
715
731
  - :default:
716
732
  :description: Expression to match to stop collecting lines
717
733
  :env_var: MDE_OUTPUT_ASSIGNMENT_END
718
- :opt_name: output_assignment_begin
734
+ :opt_name: output_assignment_end
719
735
  :procname: val_as_str
720
- - :default: "%{line} # !!!"
736
+
737
+ - :default: "%{line}"
721
738
  :description: Format for assignments from output
722
739
  :env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
723
740
  :opt_name: output_assignment_format
724
741
  :procname: val_as_str
742
+
725
743
  - :default: "^ *(?<line>\\w+=.*?) *$"
726
744
  :description: Pattern for assignments from output
727
745
  :env_var: MDE_OUTPUT_ASSIGNMENT_MATCH
728
746
  :opt_name: output_assignment_match
729
747
  :procname: val_as_str
748
+
730
749
  - :arg_name: BOOL
731
750
  :default: false
732
751
  :description: Display summary for execution
@@ -821,12 +840,24 @@
821
840
  :opt_name: prompt_debounce
822
841
  :procname: val_as_str
823
842
 
843
+ - :default: 'Name? '
844
+ :description: Prompt to enter a filespec
845
+ :env_var: MDE_PROMPT_ENTER_FILESPEC
846
+ :opt_name: prompt_enter_filespec
847
+ :procname: val_as_str
848
+
824
849
  - :default: Exit
825
850
  :description: Prompt to exit app
826
851
  :env_var: MDE_PROMPT_EXIT
827
852
  :opt_name: prompt_exit
828
853
  :procname: val_as_str
829
854
 
855
+ - :default: Other
856
+ :description: Prompt for a custom file name
857
+ :env_var: MDE_PROMPT_FILESPEC_OTHER
858
+ :opt_name: prompt_filespec_other
859
+ :procname: val_as_str
860
+
830
861
  - :default: 'No'
831
862
  :description: Prompt for no
832
863
  :env_var: MDE_PROMPT_NO
@@ -851,6 +882,12 @@
851
882
  :opt_name: prompt_select_block
852
883
  :procname: val_as_str
853
884
 
885
+ - :default: "\nChoose a file:"
886
+ :description: Prompt to select a file with inherited lines
887
+ :env_var: MDE_PROMPT_SELECT_CODE_FILE
888
+ :opt_name: prompt_select_code_file
889
+ :procname: val_as_str
890
+
854
891
  - :default: "\nChoose a file:"
855
892
  :description: Prompt to select a markdown document
856
893
  :env_var: MDE_PROMPT_SELECT_MD
@@ -863,6 +900,12 @@
863
900
  :opt_name: prompt_select_output
864
901
  :procname: val_as_str
865
902
 
903
+ - :default: 'Expr: %{expr}'
904
+ :description: prompt_show_expr_format
905
+ :env_var: MDE_PROMPT_SHOW_EXPR_FORMAT
906
+ :opt_name: prompt_show_expr_format
907
+ :procname: val_as_str
908
+
866
909
  - :default: Uninterrupted
867
910
  :description: Uninterrupted execution
868
911
  :env_var: MDE_PROMPT_UNINTERRUPTED
@@ -1047,12 +1090,18 @@
1047
1090
  :opt_name: shell_code_label_format_above
1048
1091
  :procname: val_as_str
1049
1092
 
1050
- - :default: "# -v- +%{block_name} -o- %{document_filename} -v-"
1093
+ - :default: "# -v- +%{block_name} -o- %{document_filename} -o- %{time_now_date} -v-"
1051
1094
  :description: shell_code_label_format_below
1052
1095
  :env_var: MDE_SHELL_CODE_LABEL_FORMAT_BELOW
1053
1096
  :opt_name: shell_code_label_format_below
1054
1097
  :procname: val_as_str
1055
1098
 
1099
+ - :default: "%FT%TZ"
1100
+ :description: Format for time in code lael
1101
+ :env_var: MDE_SHELL_CODE_LABEL_TIME_FORMAT
1102
+ :opt_name: shell_code_label_time_format
1103
+ :procname: val_as_str
1104
+
1056
1105
  - :description: List tab completions
1057
1106
  :long_name: tab-completions
1058
1107
  :opt_name: tab_completions
data/lib/menu.yml CHANGED
@@ -1,4 +1,4 @@
1
- # MDE - Markdown Executor (1.8.9)
1
+ # MDE - Markdown Executor (2.0.1)
2
2
  ---
3
3
  - :description: Show current configuration values
4
4
  :procname: show_config
@@ -102,6 +102,20 @@
102
102
  :long_name: dump-blocks-in-file
103
103
  :opt_name: dump_blocks_in_file
104
104
  :procname: val_as_bool
105
+ - :arg_name: BOOL
106
+ :default: false
107
+ :description: Dump inherited block_names
108
+ :env_var: MDE_DUMP_INHERITED_BLOCK_NAMES
109
+ :long_name: dump-dump-inherited-block_names
110
+ :opt_name: dump_inherited_block_names
111
+ :procname: val_as_bool
112
+ - :arg_name: BOOL
113
+ :default: false
114
+ :description: Dump inherited dependencies
115
+ :env_var: MDE_DUMP_INHERITED_DEPENDENCIES
116
+ :long_name: dump-dump-inherited-dependencies
117
+ :opt_name: dump_inherited_dependencies
118
+ :procname: val_as_bool
105
119
  - :arg_name: BOOL
106
120
  :default: false
107
121
  :description: Dump inherited lines
@@ -169,16 +183,15 @@
169
183
  tell\n tell application process \"Finder\"\n set {missing
170
184
  value, menubarHeight} to the size of menu bar 1\n end tell\n end
171
185
  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 \"# %{script_filespec}\"\n write text
177
- \"# %{output_filespec}\"\n write text \"echo -ne \\\"\\\\033];
178
- %{started_at} - %{document_filename} - %{block_name} \\\\007\\\"\"\n write
179
- text \"cd \\\"%{home}\\\"\"\n write text \"\\\"%{script_filename}\\\"
180
- | tee \\\"%{output_filespec}\\\"\"\n end tell\n end tell\n end
181
- tell'\n"
186
+ to (screenWidth * 2 / 3)\n set xoff to menubarHeight * %{batch_index}\n
187
+ \ set yoff to xoff mod (screenHeight - winHeight)\n \n create
188
+ window with default profile\n tell the first window\n set bounds
189
+ to {xoff, yoff, xoff + winWidth, yoff + winHeight}\n tell the current
190
+ session\n write text \"s=\\\"%{script_filespec}\\\"\"\n write
191
+ text \"o=\\\"%{output_filespec}\\\"\"\n write text \"cd \\\"%{home}\\\"\"\n
192
+ \ write text \"echo -ne \\\"\\\\033]; %{started_at} - %{document_filename}
193
+ - %{block_name} \\\\007\\\"\"\n write text \"\\\"$s\\\" | tee -a
194
+ \\\"$o\\\"\"\n end tell\n end tell\n end tell'\n"
182
195
  :description: execute_command_format
183
196
  :env_var: MDE_EXECUTE_COMMAND_FORMAT
184
197
  :opt_name: execute_command_format
@@ -491,7 +504,7 @@
491
504
  :env_var: MDE_MENU_NOTE_FORMAT
492
505
  :opt_name: menu_note_format
493
506
  :procname: val_as_str
494
- - :default: "^(?<line>.*?) *$"
507
+ - :default: "^(?<line>(?!/ ).*)?$"
495
508
  :description: Pattern for notes in block selection menu
496
509
  :env_var: MDE_MENU_NOTE_MATCH
497
510
  :opt_name: menu_note_match
@@ -595,9 +608,9 @@
595
608
  - :default:
596
609
  :description: Expression to match to stop collecting lines
597
610
  :env_var: MDE_OUTPUT_ASSIGNMENT_END
598
- :opt_name: output_assignment_begin
611
+ :opt_name: output_assignment_end
599
612
  :procname: val_as_str
600
- - :default: "%{line} # !!!"
613
+ - :default: "%{line}"
601
614
  :description: Format for assignments from output
602
615
  :env_var: MDE_OUTPUT_ASSIGNMENT_FORMAT
603
616
  :opt_name: output_assignment_format
@@ -693,11 +706,21 @@
693
706
  :env_var: MDE_PROMPT_DEBOUNCE
694
707
  :opt_name: prompt_debounce
695
708
  :procname: val_as_str
709
+ - :default: 'Name? '
710
+ :description: Prompt to enter a filespec
711
+ :env_var: MDE_PROMPT_ENTER_FILESPEC
712
+ :opt_name: prompt_enter_filespec
713
+ :procname: val_as_str
696
714
  - :default: Exit
697
715
  :description: Prompt to exit app
698
716
  :env_var: MDE_PROMPT_EXIT
699
717
  :opt_name: prompt_exit
700
718
  :procname: val_as_str
719
+ - :default: Other
720
+ :description: Prompt for a custom file name
721
+ :env_var: MDE_PROMPT_FILESPEC_OTHER
722
+ :opt_name: prompt_filespec_other
723
+ :procname: val_as_str
701
724
  - :default: 'No'
702
725
  :description: Prompt for no
703
726
  :env_var: MDE_PROMPT_NO
@@ -722,6 +745,13 @@
722
745
  :procname: val_as_str
723
746
  - :default: |2-
724
747
 
748
+ Choose a file:
749
+ :description: Prompt to select a file with inherited lines
750
+ :env_var: MDE_PROMPT_SELECT_CODE_FILE
751
+ :opt_name: prompt_select_code_file
752
+ :procname: val_as_str
753
+ - :default: |2-
754
+
725
755
  Choose a file:
726
756
  :description: Prompt to select a markdown document
727
757
  :env_var: MDE_PROMPT_SELECT_MD
@@ -734,6 +764,11 @@
734
764
  :env_var: MDE_PROMPT_SELECT_OUTPUT
735
765
  :opt_name: prompt_select_output
736
766
  :procname: val_as_str
767
+ - :default: 'Expr: %{expr}'
768
+ :description: prompt_show_expr_format
769
+ :env_var: MDE_PROMPT_SHOW_EXPR_FORMAT
770
+ :opt_name: prompt_show_expr_format
771
+ :procname: val_as_str
737
772
  - :default: Uninterrupted
738
773
  :description: Uninterrupted execution
739
774
  :env_var: MDE_PROMPT_UNINTERRUPTED
@@ -894,11 +929,17 @@
894
929
  :env_var: MDE_SHELL_CODE_LABEL_FORMAT_ABOVE
895
930
  :opt_name: shell_code_label_format_above
896
931
  :procname: val_as_str
897
- - :default: "# -v- +%{block_name} -o- %{document_filename} -v-"
932
+ - :default: "# -v- +%{block_name} -o- %{document_filename} -o- %{time_now_date}
933
+ \ -v-"
898
934
  :description: shell_code_label_format_below
899
935
  :env_var: MDE_SHELL_CODE_LABEL_FORMAT_BELOW
900
936
  :opt_name: shell_code_label_format_below
901
937
  :procname: val_as_str
938
+ - :default: "%FT%TZ"
939
+ :description: Format for time in code lael
940
+ :env_var: MDE_SHELL_CODE_LABEL_TIME_FORMAT
941
+ :opt_name: shell_code_label_time_format
942
+ :procname: val_as_str
902
943
  - :description: List tab completions
903
944
  :long_name: tab-completions
904
945
  :opt_name: tab_completions