Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/dotmd/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function M.pick(opts)
opts.type = opts.type or "notes"
opts.grep = opts.grep or false

local dirs = directories.get_picker_dirs(opts)
local dirs = directories.get_picker_dirs(opts.type)

local prompt_name_type = opts.type == "all" and " "
or " " .. opts.type .. " "
Expand Down
12 changes: 6 additions & 6 deletions lua/dotmd/directories.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ function M.get_root_dir()
end

--- Get directories for picker
---@param opts DotMd.PickOpts Options for picking the file
---@param type DotMd.PickType Options for picking the file
---@return string[] dirs The directories to pick from
function M.get_picker_dirs(opts)
function M.get_picker_dirs(type)
local dirs = {}
if opts.type == "all" then
if type == "all" then
table.insert(dirs, M.get_notes_dir())
table.insert(dirs, M.get_todo_dir())
table.insert(dirs, M.get_journal_dir())
elseif opts.type == "notes" then
elseif type == "notes" then
table.insert(dirs, M.get_notes_dir())
elseif opts.type == "todos" then
elseif type == "todos" then
table.insert(dirs, M.get_todo_dir())
elseif opts.type == "journal" then
elseif type == "journal" then
table.insert(dirs, M.get_journal_dir())
end
return dirs
Expand Down
8 changes: 4 additions & 4 deletions tests/directories_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe("dotmd.directories module", function()
describe("get_picker_dirs", function()
it("should return all directories when type is 'all'", function()
local opts = { type = "all" }
local dirs = directories.get_picker_dirs(opts)
local dirs = directories.get_picker_dirs(opts.type)
local expected = {
test_config.root_dir .. test_config.dir_names["notes"] .. "/",
test_config.root_dir .. test_config.dir_names["todo"] .. "/",
Expand All @@ -84,7 +84,7 @@ describe("dotmd.directories module", function()

it("should return only notes directory when type is 'notes'", function()
local opts = { type = "notes" }
local dirs = directories.get_picker_dirs(opts)
local dirs = directories.get_picker_dirs(opts.type)
local expected = {
test_config.root_dir .. test_config.dir_names["notes"] .. "/",
}
Expand All @@ -93,7 +93,7 @@ describe("dotmd.directories module", function()

it("should return only todos directory when type is 'todos'", function()
local opts = { type = "todos" }
local dirs = directories.get_picker_dirs(opts)
local dirs = directories.get_picker_dirs(opts.type)
local expected = {
test_config.root_dir .. test_config.dir_names["todo"] .. "/",
}
Expand All @@ -104,7 +104,7 @@ describe("dotmd.directories module", function()
"should return only journal directory when type is 'journal'",
function()
local opts = { type = "journal" }
local dirs = directories.get_picker_dirs(opts)
local dirs = directories.get_picker_dirs(opts.type)
local expected = {
test_config.root_dir
.. test_config.dir_names["journal"]
Expand Down