aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-12 22:50:10 +0100
committermms <git@sapka.me>2024-11-12 23:12:55 +0100
commit22560fbfbe2214f260c71c0ae5c928f81a431b76 (patch)
tree0b47e7c63f715fab3a347bf08d5f50ea9e8a9561 /lib
parent955739e2a7be70e6abf7e95710ffe0f4a9c64481 (diff)
feat: README
Diffstat (limited to 'lib')
-rw-r--r--lib/osugiru.rb5
-rw-r--r--lib/osugiru/database.rb2
-rw-r--r--lib/osugiru/message.rb17
3 files changed, 19 insertions, 5 deletions
diff --git a/lib/osugiru.rb b/lib/osugiru.rb
index 91a2c06..4e99212 100644
--- a/lib/osugiru.rb
+++ b/lib/osugiru.rb
@@ -3,12 +3,13 @@
require 'notmuch'
require 'pry'
-require_relative 'osugiru/database'
require_relative 'osugiru/config'
+require_relative 'osugiru/database'
+require_relative 'osugiru/helpers'
require_relative 'osugiru/message'
require_relative 'osugiru/messages'
-require_relative 'osugiru/helpers'
require_relative 'osugiru/ruleset'
+require_relative 'osugiru/tags'
module Osugiru
class << self
diff --git a/lib/osugiru/database.rb b/lib/osugiru/database.rb
index d014c94..0d33a24 100644
--- a/lib/osugiru/database.rb
+++ b/lib/osugiru/database.rb
@@ -5,7 +5,7 @@ module Osugiru
attr_reader :db
def initialize(path:)
- @db = ::Notmuch::Database.new(path)
+ @db = ::Notmuch::Database.new(path, mode: Notmuch::MODE_READ_WRITE)
end
def query(query)
diff --git a/lib/osugiru/message.rb b/lib/osugiru/message.rb
index 3446f17..0555724 100644
--- a/lib/osugiru/message.rb
+++ b/lib/osugiru/message.rb
@@ -6,9 +6,10 @@ module Osugiru
def initialize(msg:)
@message = msg
+ @tags = @message.tags
end
- def method_missing(method_name, *_args)
+ def method_missing(method_name, *_args)
handle_get(Osugiru::Helpers.header_name_from_dsl(method_name))
end
@@ -17,7 +18,19 @@ module Osugiru
end
def tags
- @message.tags
+ @tags
+ end
+
+ def tags=(new_tags)
+ @tags = new_tags
+ end
+
+ def save!
+ message.remove_all_tags
+ tags.each do |tag|
+ message.add_tag(tag)
+ end
+ binding.pry
end
end
end