Class: Aircana::FzfHelper
- Inherits:
-
Object
- Object
- Aircana::FzfHelper
- Defined in:
- lib/aircana/fzf_helper.rb
Class Method Summary collapse
- .execute_fzf_selection(header:, multi:) ⇒ Object
- .fzf_available? ⇒ Boolean
- .select_files_interactively(header: "Select files", multi: true) ⇒ Object
Class Method Details
.execute_fzf_selection(header:, multi:) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/aircana/fzf_helper.rb', line 22 def execute_fzf_selection(header:, multi:) command = build_fzf_command(header: header, multi: multi) result = `#{command}`.strip return [] if result.empty? result.split("\n").map(&:strip).reject(&:empty?) end |
.fzf_available? ⇒ Boolean
15 16 17 18 19 20 |
# File 'lib/aircana/fzf_helper.rb', line 15 def fzf_available? return true if command_available?("fzf") handle_missing_dependency false end |
.select_files_interactively(header: "Select files", multi: true) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/aircana/fzf_helper.rb', line 6 def select_files_interactively(header: "Select files", multi: true) return [] unless fzf_available? execute_fzf_selection(header: header, multi: multi) rescue StandardError => e Aircana.human_logger.error "File selection failed: #{e.message}" [] end |