Skip to content

Commit

Permalink
scaffolding other mods
Browse files Browse the repository at this point in the history
  • Loading branch information
clpi committed Nov 16, 2024
1 parent 0e887fc commit e0ad7a7
Show file tree
Hide file tree
Showing 22 changed files with 383 additions and 643 deletions.
File renamed without changes.
7 changes: 7 additions & 0 deletions lua/dorm/mod/base/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ local mod = dorm.mod

return mod.create_meta(
-- "treesitter",

"base",
"encrypt",
"autocmd",
"notes",
"maps",
"cmd",
"store",
"code",
"metadata",
"capture",
"template",
"run",
"search",
"todo",
"ui",
"calendar",
Expand Down
61 changes: 61 additions & 0 deletions lua/dorm/mod/capture/module.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
local d = require("dorm")
local lib, mod = d.lib, d.mod

local module = mod.create("capture")

module.load = function()
mod.await("cmd", function(cmd)
cmd.add_commands_from_table({
["capture"] = {
subcommands = {
update = {
args = 0,
name = "capture.update"
},
insert = {
name = "capture.insert",
args = 0,
},
},
name = "capture"
}
})
end)
end



module.setup = function()
return {
success = true,
requires = {
"workspace"
}

}
end

module.public = {

}

module.config.private = {

}
module.config.public = {

}
module.private = {

}
module.events = {}


module.events.subscribed = {
cmd = {
["capture.insert"] = true,
["capture.update"] = true,
},
}

return module
1 change: 1 addition & 0 deletions lua/dorm/mod/cmd/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module.load = function()
-- If the user passes no arguments or too few, we'll query them for the remainder using select_next_cmd_arg.
vim.api.nvim_create_user_command("Dorm", module.private.command_callback, {
desc = "The dorm command",
force = true,
-- bang = true,
nargs = "*",
complete = module.private.generate_completions,
Expand Down
File renamed without changes.
Empty file added lua/dorm/mod/data/module.lua
Empty file.
61 changes: 61 additions & 0 deletions lua/dorm/mod/encrypt/module.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
local d = require("dorm")
local lib, mod = d.lib, d.mod

local module = mod.create("encrypt")

module.load = function()
mod.await("cmd", function(cmd)
cmd.add_commands_from_table({
["encrypt"] = {
subcommands = {
update = {
args = 0,
name = "encrypt.update"
},
insert = {
name = "encrypt.insert",
args = 0,
},
},
name = "encrypt"
}
})
end)
end



module.setup = function()
return {
success = true,
requires = {
"workspace"
}

}
end

module.public = {

}

module.config.private = {

}
module.config.public = {

}
module.private = {

}
module.events = {}


module.events.subscribed = {
cmd = {
["encrypt.insert"] = true,
["encrypt.update"] = true,
},
}

return module
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions lua/dorm/mod/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ local utils = require("dorm.util")
--- @field ["ui.text_popup"] Mi.text_popup

--- Defines both a public and private configuration for a dorm module.
--- Public configurations may be tweaked by the user from the `dorm.setup()` function,
--- whereas private configurations are for internal use only.
--- Public configurations may be tweaked by the user from the `dorm.setup()` function, whereas private configurations are for internal use only.
--- @class (exact) dorm.module.configuration
--- @field custom? table Internal table that tracks the differences (changes) between the base `public` table and the new (altered) `public` table. It contains only the tables that the user has altered in their own configuration.
--- @field public private? table Internal configuration variables that may be tweaked by the developer.
Expand Down
Empty file added lua/dorm/mod/lsp/module.lua
Empty file.
61 changes: 61 additions & 0 deletions lua/dorm/mod/metadata/module.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
local d = require("dorm")
local lib, mod = d.lib, d.mod

local module = mod.create("metadata")

module.load = function()
mod.await("cmd", function(cmd)
cmd.add_commands_from_table({
["metadata"] = {
subcommands = {
update = {
args = 0,
name = "metadata.update"
},
insert = {
name = "metadata.insert",
args = 0,
},
},
name = "metadata"
}
})
end)
end



module.setup = function()
return {
success = true,
requires = {
"workspace"
}

}
end

module.public = {

}

module.config.private = {

}
module.config.public = {

}
module.private = {

}
module.events = {}


module.events.subscribed = {
cmd = {
["metadata.insert"] = true,
["metadata.update"] = true,
},
}

return module
10 changes: 5 additions & 5 deletions lua/dorm/mod/notes/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ module.private = {
end

-- If it's a .dorm file, also ensure it is a day entry
if dtype == "file" and string.match(dname, "%d%d%.dorm") then
if dtype == "file" and string.match(dname, "%d%d%.md") then
-- Split the file name
local file = vim.split(dname, ".", { plain = true })

Expand Down Expand Up @@ -291,7 +291,7 @@ module.private = {
-- If it is a .dorm file, but it's not any user generated file.
-- The match is here to avoid handling files made by the user, like a template file, or
-- the toc file
if type == "file" and string.match(name, "%d+-%d+-%d+%.dorm") then
if type == "file" and string.match(name, "%d+-%d+-%d+%.md") then
-- Split yyyy-mm-dd to a table
local file = vim.split(name, ".", { plain = true })
local parts = vim.split(file[1], "-")
Expand Down Expand Up @@ -395,7 +395,7 @@ module.config.public = {
strategy = "nested",

-- The name of the template file to use when running `:Dorm notes template`.
template_name = "template.dorm",
template_name = "template.md",

-- Whether to apply the template file to new notes entries.
use_template = true,
Expand All @@ -409,8 +409,8 @@ module.config.public = {

module.config.private = {
strategies = {
flat = "%Y-%m-%d.dorm",
nested = "%Y" .. config.pathsep .. "%m" .. config.pathsep .. "%d.dorm",
flat = "%Y-%m-%d.md",
nested = "%Y" .. config.pathsep .. "%m" .. config.pathsep .. "%d.md",
},
}

Expand Down
Empty file added lua/dorm/mod/preview/module.lua
Empty file.
Empty file added lua/dorm/mod/publish/module.lua
Empty file.
61 changes: 61 additions & 0 deletions lua/dorm/mod/run/module.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
local d = require("dorm")
local lib, mod = d.lib, d.mod

local module = mod.create("run")

module.load = function()
mod.await("cmd", function(cmd)
cmd.add_commands_from_table({
["run"] = {
subcommands = {
update = {
args = 0,
name = "run.update"
},
insert = {
name = "run.insert",
args = 0,
},
},
name = "run"
}
})
end)
end



module.setup = function()
return {
success = true,
requires = {
"workspace"
}

}
end

module.public = {

}

module.config.private = {

}
module.config.public = {

}
module.private = {

}
module.events = {}


module.events.subscribed = {
cmd = {
["run.insert"] = true,
["run.update"] = true,
},
}

return module
61 changes: 61 additions & 0 deletions lua/dorm/mod/search/module.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
local d = require("dorm")
local lib, mod = d.lib, d.mod

local module = mod.create("search")

module.load = function()
mod.await("cmd", function(cmd)
cmd.add_commands_from_table({
["search"] = {
subcommands = {
update = {
args = 0,
name = "search.update"
},
insert = {
name = "search.insert",
args = 0,
},
},
name = "search"
}
})
end)
end



module.setup = function()
return {
success = true,
requires = {
"workspace"
}

}
end

module.public = {

}

module.config.private = {

}
module.config.public = {

}
module.private = {

}
module.events = {}


module.events.subscribed = {
cmd = {
["search.insert"] = true,
["search.update"] = true,
},
}

return module
Loading

0 comments on commit e0ad7a7

Please sign in to comment.