Method: HookApp#copy_bookmark

Defined in:
lib/hook/hookapp.rb

#copy_bookmark(title, url, opts) ⇒ Object

Create a bookmark from specified title and url and copy to the clipboard.



189
190
191
192
193
194
195
# File 'lib/hook/hookapp.rb', line 189

def copy_bookmark(title, url, opts)
  raise "No URL found" if url.empty?
  title = title.empty? ? 'No title' : title
  output = opts[:markdown] ? "[#{title}](#{url})" : url
  output.clip
  %(Copied #{opts[:markdown] ? 'Markdown link' : 'Hook URL'} for '#{title}' to clipboard)
end