summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-03 02:16:58 +0200
committerThanos Apollo <[email protected]>2024-03-03 02:16:58 +0200
commit892735c7fa2215b4902f8d993f0b6c85083de768 (patch)
treebc86cc273b70525055c453c86f87752373621186
parent4c43f94dec497dc967f7ecee88a49f185ff3d9cf (diff)
gnosis--get-deck-name: Add optional id arg
If id is given, return the name for deck id
-rw-r--r--gnosis.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/gnosis.el b/gnosis.el
index 7cc04fe..2cb4d44 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -394,11 +394,13 @@ Set SPLIT to t to split all input given."
(gnosis--insert-into 'decks `([nil ,name nil nil nil nil]))
(message "Created deck '%s'" name)))
-(defun gnosis--get-deck-name ()
+(defun gnosis--get-deck-name (&optional id)
"Return name from table DECKS."
(when (equal (gnosis-select 'name 'decks) nil)
(error "No decks found"))
- (funcall gnosis-completing-read-function "Deck: " (gnosis-select 'name 'decks)))
+ (if id
+ (gnosis-get 'name 'decks `(= id ,id))
+ (funcall gnosis-completing-read-function "Deck: " (gnosis-select 'name 'decks))))
(cl-defun gnosis--get-deck-id (&optional (deck (gnosis--get-deck-name)))
"Return id for DECK name."