diff options
Diffstat (limited to 'main.rb')
-rwxr-xr-x[-rw-r--r--] | main.rb | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,3 +1,5 @@ +#!/bin/env ruby + require 'nokogiri' require 'open-uri' require 'getoptlong' @@ -10,13 +12,15 @@ opts = GetoptLong.new( [ '--comment', '-c', GetoptLong::OPTIONAL_ARGUMENT ] ) +QUICKNOTE_PATH = '/home/lemon/Documents/Notes/quicknote.md' + comment = nil opts.each do |opt, arg| case opt when '--help' puts <<-EOF - quicknote grabs whatever URL you give it, parses out the title of the web page, and save it somewhere nice. + quicknote grabs whatever URL you have in the clipboard, parses out the title of the web page, and save it somewhere nice. That is all. EOF @@ -42,7 +46,7 @@ URI.open(url) do |f| title_out = title end -open('/tmp/toss.txt', 'a') do |f| +open(QUICKNOTE_PATH, 'a') do |f| if comment f << "#{comment}: [#{title_out}](#{url})" + "\n" else |