lib/filerary/command.rb in filerary-0.0.6 vs lib/filerary/command.rb in filerary-0.0.7

- old
+ new

@@ -22,16 +22,39 @@ desc "search WORD", "Search for files in the collection" def search(word) puts Filerary::Librarian.new.search(word) end + desc "show PATH", "Show a file content" + def show(path) + begin + puts Filerary::Librarian.new.show(path) + rescue ArgumentError => e + STDERR.puts "#{e.class}: #{e.message}: #{path}" + end + end + + desc "update", "Update the collection" + def update + Filerary::Librarian.new.update + end + desc "cleanup", "Remove deleted files in the collection" def cleanup Filerary::Librarian.new.cleanup end desc "remove PATH", "Remove a file in the collection" def remove(path) - Filerary::Librarian.new.remove(path) + begin + Filerary::Librarian.new.remove(path) + rescue ArgumentError => e + STDERR.puts "#{e.class}: #{e.message}: #{path}" + end + end + + desc "destroy", "Delete the database and the collection" + def destroy + Filerary::Librarian.new.destroy end end end