lib/markdown_exec.rb in markdown_exec-1.8.2 vs lib/markdown_exec.rb in markdown_exec-1.8.4
- old
+ new
@@ -39,12 +39,10 @@
tap_config envvar: MarkdownExec::TAP_DEBUG
$stderr.sync = true
$stdout.sync = true
-MDE_HISTORY_ENV_NAME = 'MDE_MENU_HISTORY'
-
# custom error: file specified is missing
#
class FileMissingError < StandardError; end
def dp(str)
@@ -170,30 +168,10 @@
bash: true, # bash block parsing in get_block_summary()
saved_script_filename: nil # calculated
}
end
- def clear_required_file
- ENV['MDE_LINK_REQUIRED_FILE'] = ''
- end
-
- # # Deletes a required temporary file specified by an environment variable.
- # # The function checks if the file exists before attempting to delete it.
- # # Clears the environment variable after deletion.
- # #
- # def delete_required_temp_file
- # temp_blocks_file_path = ENV.fetch('MDE_LINK_REQUIRED_FILE', nil)
-
- # return if temp_blocks_file_path.nil? || temp_blocks_file_path.empty?
-
- # FileUtils.rm_f(temp_blocks_file_path)
-
- # clear_required_file
- # rescue StandardError
- # error_handler('delete_required_temp_file')
- # end
-
public
## Determines the correct filename to use for searching files
#
def determine_filename(specified_filename: nil, specified_folder: nil, default_filename: nil,
@@ -366,29 +344,30 @@
@fout.fout 'Searching in: ' \
"#{HashDelegator.new(@options).string_send_color(@options[:path],
:menu_chrome_color)}"
searcher = DirectorySearcher.new(value, [@options[:path]])
+ @fout.fout 'In file contents'
+ hash = searcher.search_in_file_contents
+ hash.each.with_index do |(key, v2), i1|
+ @fout.fout format('- %3.d: %s', i1 + 1, key)
+ @fout.fout AnsiFormatter.new(options).format_and_highlight_array(
+ v2.map { |nl| format('=%4.d: %s', nl.index, nl.line) },
+ highlight: [value]
+ )
+ end
+
@fout.fout 'In directory names'
@fout.fout AnsiFormatter.new(options).format_and_highlight_array(
searcher.search_in_directory_names, highlight: [value]
)
@fout.fout 'In file names'
@fout.fout AnsiFormatter.new(options).format_and_highlight_array(
searcher.search_in_file_names, highlight: [value]
).join("\n")
- @fout.fout 'In file contents'
- hash = searcher.search_in_file_contents
- hash.each.with_index do |(key, v2), i1|
- @fout.fout format('- %3.d: %s', i1 + 1, key)
- @fout.fout AnsiFormatter.new(options).format_and_highlight_array(
- v2.map { |nl| format('=%4.d: %s', nl.index, nl.line) },
- highlight: [value]
- )
- end
exit
}
when 'help'
->(_) {
@fout.fout menu_help
@@ -543,13 +522,11 @@
end
public
def run
- clear_required_file
initialize_and_parse_cli_options
execute_block_with_error_handling
- @options.delete_required_temp_file
rescue StandardError
error_handler('run')
end
private