diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 8ecd522..5597915 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -59,6 +59,7 @@ local function file_exists(fname) if f~=nil then io.close(f) return true else return false end end + local function daysuffix(day) if((day == '1') or (day == '21') or (day == '31')) then return 'st' end if((day == '2') or (day == '22')) then return 'nd' end @@ -66,6 +67,7 @@ local function daysuffix(day) return 'th' end + local function linesubst(line, title) local substs = { date = os.date('%Y-%m-%d'), @@ -81,6 +83,7 @@ local function linesubst(line, title) return line end + local create_note_from_template = function (title, filepath, templatefn) -- first, read the template file local lines = {} @@ -98,21 +101,6 @@ local create_note_from_template = function (title, filepath, templatefn) end - --- --- InstallDailyFinder: --- ------------------- --- --- downloads the daily finder scripts to the configured `my_bin` directory --- and makes it executable --- -InstallDailyFinder = function() - local destpath = ZkCfg.my_bin .. '/' .. ZkCfg.daily_finder - local cmd = downloader2cmd[ZkCfg.downloader] - vim.api.nvim_command('!'.. cmd .. ' ' .. destpath .. ' https://raw.githubusercontent.com/renerocksai/telekasten.nvim/main/ext_commands/daily_finder.sh') - vim.api.nvim_command('!chmod +x ' .. destpath) -end - local path_to_linkname = function(p) local fn = vim.split(p, "/") fn = fn[#fn] @@ -121,6 +109,7 @@ local path_to_linkname = function(p) return fn end + local zk_entry_maker = function(entry) return { value = entry, @@ -137,6 +126,21 @@ local check_local_finder = function() end +-- +-- InstallDailyFinder: +-- ------------------- +-- +-- downloads the daily finder scripts to the configured `my_bin` directory +-- and makes it executable +-- +InstallDailyFinder = function() + local destpath = ZkCfg.my_bin .. '/' .. ZkCfg.daily_finder + local cmd = downloader2cmd[ZkCfg.downloader] + vim.api.nvim_command('!'.. cmd .. ' ' .. destpath .. ' https://raw.githubusercontent.com/renerocksai/telekasten.nvim/main/ext_commands/daily_finder.sh') + vim.api.nvim_command('!chmod +x ' .. destpath) +end + + -- -- FindDailyNotes: