Class: FastlaneCore::Clipboard

Inherits:
Object
  • Object
show all
Defined in:
fastlane_core/lib/fastlane_core/clipboard.rb

Class Method Summary collapse

Class Method Details

.copy(content: nil) ⇒ Object



6
7
8
9
# File 'fastlane_core/lib/fastlane_core/clipboard.rb', line 6

def self.copy(content: nil)
  return UI.crash!("'pbcopy' or 'pbpaste' command not found.") unless is_supported?
  Open3.popen3('pbcopy') { |input, _, _| input << content }
end

.is_supported?Boolean

Returns:



16
17
18
# File 'fastlane_core/lib/fastlane_core/clipboard.rb', line 16

def self.is_supported?
  return `which pbcopy`.length > 0 && `which pbpaste`.length > 0
end

.pasteObject



11
12
13
14
# File 'fastlane_core/lib/fastlane_core/clipboard.rb', line 11

def self.paste
  return UI.crash!("'pbcopy' or 'pbpaste' command not found.") unless is_supported?
  return `pbpaste`
end