lib/markdown_exec.rb in markdown_exec-1.8.1 vs lib/markdown_exec.rb in markdown_exec-1.8.2
- old
+ new
@@ -220,11 +220,11 @@
# end
# Reports and executes block logic
def execute_block_logic(files)
@options[:filename] = select_document_if_multiple(files)
- @options.select_approve_and_execute_block
+ @options.select_execute_bash_and_special_blocks
end
## Executes the block specified in the options
#
def execute_block_with_error_handling
@@ -242,21 +242,21 @@
options = calculated_options.merge(options)
update_options(options, over: false)
simple_commands = {
doc_glob: -> { @fout.fout options[:md_filename_glob] },
- list_blocks: -> { list_blocks },
+ # list_blocks: -> { list_blocks },
+ list_default_env: -> { @fout.fout_list list_default_env },
list_default_yaml: -> { @fout.fout_list list_default_yaml },
list_docs: -> { @fout.fout_list files },
- list_default_env: -> { @fout.fout_list list_default_env },
- list_recent_output: lambda {
+ list_recent_output: -> {
@fout.fout_list list_recent_output(
@options[:saved_stdout_folder],
@options[:saved_stdout_glob], @options[:list_count]
)
},
- list_recent_scripts: lambda {
+ list_recent_scripts: -> {
@fout.fout_list list_recent_scripts(
options[:saved_script_folder],
options[:saved_script_glob], options[:list_count]
)
},
@@ -356,21 +356,18 @@
# @param options [Hash] The options hash, necessary for some lambdas to access.
# @return [Lambda] The corresponding lambda expression.
def lambda_for_procname(procname, options)
case procname
when 'debug'
- ->(value) {
- tap_config value: value
- }
+ ->(value) { tap_config value: value }
when 'exit'
->(_) { exit }
-
when 'find'
->(value) {
- # initialize_and_parse_cli_options
- @fout.fout "Searching in: " \
- "#{HashDelegator.new(@options).string_send_color(@options[:path], :menu_chrome_color)}"
+ @fout.fout 'Searching in: ' \
+ "#{HashDelegator.new(@options).string_send_color(@options[:path],
+ :menu_chrome_color)}"
searcher = DirectorySearcher.new(value, [@options[:path]])
@fout.fout 'In directory names'
@fout.fout AnsiFormatter.new(options).format_and_highlight_array(
searcher.search_in_directory_names, highlight: [value]
@@ -390,20 +387,17 @@
highlight: [value]
)
end
exit
}
-
when 'help'
->(_) {
@fout.fout menu_help
exit
}
- # when %w[who what where why how which when whom]
when 'how'
->(value) {
- # value = 'color'
@fout.fout(list_default_yaml.select { |line| line.include? value })
exit
}
when 'path'
->(value) {
@@ -430,11 +424,11 @@
else
procname
end
end
- def list_blocks; end
+ # def list_blocks; end
def list_default_env
menu_iter do |item|
next unless item[:env_var].present?
@@ -566,11 +560,11 @@
@options[:saved_script_glob])
return unless filename
saved_name_split filename
@options[:save_executed_script] = false
- @options.select_approve_and_execute_block
+ @options.select_execute_bash_and_special_blocks
rescue StandardError
error_handler('run_last_script')
end
def saved_name_split(name)
@@ -633,10 +627,10 @@
)
return if filename.nil?
saved_name_split(filename)
- @options.select_approve_and_execute_block ### ({ save_executed_script: false })
+ @options.select_execute_bash_and_special_blocks ### ({ save_executed_script: false })
end
public
def tab_completions(data = menu_for_optparse)