aboutsummaryrefslogtreecommitdiff
path: root/lua/simple-denote/api.lua
diff options
context:
space:
mode:
authorDefaultGen <gravel.justness270@slmail.me>2024-06-05 14:25:05 -0400
committerDefaultGen <gravel.justness270@slmail.me>2024-06-05 14:25:05 -0400
commit5e8cd8762c2894b40036ce0bc02a15c3b23ce5bd (patch)
treecba5179131093b58e7e7cb9bcbb7c2837dc3f0ac /lua/simple-denote/api.lua
parent5939127700344d86a560a3765b2138f23ab2862e (diff)
downloadsimple-denote.nvim-5e8cd8762c2894b40036ce0bc02a15c3b23ce5bd.tar.gz
Fixed signature and heading edge cases
Diffstat (limited to 'lua/simple-denote/api.lua')
-rw-r--r--lua/simple-denote/api.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/lua/simple-denote/api.lua b/lua/simple-denote/api.lua
index d986469..05d645a 100644
--- a/lua/simple-denote/api.lua
+++ b/lua/simple-denote/api.lua
@@ -3,12 +3,12 @@ local M = {}
local internal = require("simple-denote.internal")
---@param options table
----@param name string|nil
+---@param title string|nil
---@param tags table|nil
-function M.note(options, name, tags)
- if not name then
+function M.note(options, title, tags)
+ if not title then
vim.ui.input({ prompt = "Note title: " }, function(input)
- name = input
+ title = input
end)
end
if not tags then
@@ -16,12 +16,13 @@ function M.note(options, name, tags)
tags = input
end)
end
- internal.note(options, name, tags)
+ if not title or not tags then return end
+ internal.note(options, title, tags)
end
---@param options table
---@param filename string|nil
----@param new_title string|nil
+---@param title string|nil
function M.title(options, filename, title)
if not filename then
filename = vim.fn.expand("%")
@@ -31,6 +32,7 @@ function M.title(options, filename, title)
title = input
end)
end
+ if not title then return end
internal.title(options, filename, title)
end
@@ -46,6 +48,7 @@ function M.tag(options, filename, tags)
tags = input
end)
end
+ if not tags then return end
internal.tag(options, filename, tags)
end
@@ -59,6 +62,7 @@ function M.signature(options, filename, sig)
sig = input
end)
end
+ if not sig then return end
internal.signature(options, filename, sig)
end