lib/markdown_exec.rb in markdown_exec-2.6.0 vs lib/markdown_exec.rb in markdown_exec-2.7.0
- old
+ new
@@ -4,10 +4,11 @@
# encoding=utf-8
require 'English'
require 'clipboard'
require 'fileutils'
+require 'io/console'
require 'open3'
require 'optparse'
require 'shellwords'
require 'time'
require 'tmpdir'
@@ -403,10 +404,11 @@
## Executes the block specified in the options
#
def execute_block_with_error_handling
finalize_cli_argument_processing
+ @options.register_console_attributes(@options)
execute_initial_commands_and_main_loop(@options, @options.run_state)
rescue FileMissingError
warn "File missing: #{$!}"
end
@@ -989,10 +991,11 @@
@options[:filename] = mf[:file].gsub(@options[:saved_filename_pattern],
@options[:saved_filename_replacement])
end
def select_document_if_multiple(files = list_markdown_files_in_path,
+ cycle: true,
prompt: options[:prompt_select_md].to_s)
return files[0] if (count = files.count) == 1
return unless count >= 2
@@ -1002,10 +1005,12 @@
.string_send_color(
prompt,
:prompt_color_after_script_execution
),
files,
- opts.merge(per_page: opts[:select_page_height])
+ HashDelegator.options_for_tty_menu(opts).merge(
+ cycle: cycle
+ )
)
end
# Presents a TTY prompt to select an option or exit, returns selected option or nil
def select_option_or_exit(prompt_text, strings, opts = {})