diff options
author | Matthew Lemon <y@yulqen.org> | 2023-12-21 20:13:07 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-12-21 20:13:07 +0000 |
commit | fc6852b23cbffeebaf35c9676c76055cc49917d3 (patch) | |
tree | 85ed10fad2d673c787a0cb5ed9a81b4f5ce23f7b | |
parent | e512c58cbd5373dc17b4cb65671a7aa38afa3240 (diff) |
Finishing touches...
-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 |