module Noty
Constants
- STORAGE_PATH
- VERSION
Public Instance Methods
bookmark()
click to toggle source
# File lib/noty.rb, line 55 def bookmark bm = Bookmark.from_url(ARGV.first) bm.save bm.edit end
help()
click to toggle source
# File lib/noty.rb, line 15 def help version puts <<-EOT Snippets and bookmarks manager. Usage: noty [command|inputs] Commands: help, -h, --help : print this message version, -v, --version : print noty version Input types: url: e.g "http://www.example.com", add URL as a bookmark file keyword: search bookmarks and perform action on it, a single word of multiple words or regex, it is passed to "ag silver searcher" snippet text: any multiword text, it will search first if no files contain this text you'll be asked if you want to create a snippet for it EOT end
search()
click to toggle source
# File lib/noty.rb, line 34 def search keyword = ARGV.join ' ' result = Services.search(keyword) if !result.empty? UI.choose result elsif keyword.include?(' ') choice = ask 'Do you want to save it as a snippet? [y/N]: ' snippet if choice.casecmp 'y' end end
snippet()
click to toggle source
# File lib/noty.rb, line 46 def snippet content = ARGV.join ' ' path = File.join(Noty::STORAGE_PATH, Time.now.to_i.to_s + '.snippet') snippet = Snippet.new(path) snippet.content = content snippet.save end
version()
click to toggle source
# File lib/noty.rb, line 11 def version puts "Noty version #{VERSION}" end