Skip to content

Commit 60ce829

Browse files
committed
feat: custom tags, column header editing
1 parent 7ba03b0 commit 60ce829

7 files changed

Lines changed: 1176 additions & 128 deletions

File tree

src/backend.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,31 @@ impl Backend {
129129
})
130130
}
131131

132+
pub fn add_tag_key(&mut self, category: Category, key: &str) -> io::Result<Option<String>> {
133+
self.db.add_tag_key(category, key)
134+
}
135+
136+
pub fn remove_tag_key(&mut self, category: Category, key: &str) -> io::Result<bool> {
137+
self.db.remove_tag_key(category, key)
138+
}
139+
140+
pub fn rename_tag_key(
141+
&mut self,
142+
category: Category,
143+
old_key: &str,
144+
new_key: &str,
145+
) -> io::Result<()> {
146+
self.db.rename_tag_key(category, old_key, new_key)?;
147+
self.refresh_category(category)
148+
}
149+
132150
pub fn add_tag(
133151
&mut self,
134152
category: Category,
135153
path: &Path,
136154
key: &str,
137155
value: &str,
138156
) -> io::Result<()> {
139-
let Some(key) = canonical_category_key(category, key) else {
140-
return Ok(());
141-
};
142157
let stem = file_stem(path);
143158
self.db.add_tag(category, &stem, key, value)
144159
}
@@ -150,9 +165,6 @@ impl Backend {
150165
key: &str,
151166
value: &str,
152167
) -> io::Result<()> {
153-
let Some(key) = canonical_category_key(category, key) else {
154-
return Ok(());
155-
};
156168
let stem = file_stem(path);
157169
self.db.remove_tag(category, &stem, key, value)
158170
}
@@ -165,9 +177,6 @@ impl Backend {
165177
old_value: &str,
166178
new_value: &str,
167179
) -> io::Result<()> {
168-
let Some(key) = canonical_category_key(category, key) else {
169-
return Ok(());
170-
};
171180
let stem = file_stem(path);
172181
self.db
173182
.rename_stem_tag_value(category, &stem, key, old_value, new_value)

0 commit comments

Comments
 (0)