refactor(core): move git module over to configz
This commit is contained in:
parent
48a18162a0
commit
bbb12f136a
6 changed files with 73 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -6,6 +6,7 @@
|
|||
.resource_types
|
||||
info.rb
|
||||
.rerun.json
|
||||
data/personal.lua
|
||||
|
||||
### Puppet Bolt ###
|
||||
.modules
|
||||
|
|
@ -123,4 +124,4 @@ tags
|
|||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/puppet,emacs,code,vim,linux
|
||||
# End of https://www.toptal.com/developers/gitignore/api/puppet,emacs,code,vim,linux
|
||||
|
|
|
|||
3
data/common.lua
Normal file
3
data/common.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
user_name = "Ade Attwood",
|
||||
}
|
||||
18
lib/data.lua
Normal file
18
lib/data.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
local data = {}
|
||||
|
||||
data.lookup = function(scope, key)
|
||||
local ok, module = pcall(require, string.format("data.%s", scope))
|
||||
if not ok then
|
||||
configz.error(string.format("data.%s does not exist", scope))
|
||||
return ""
|
||||
end
|
||||
|
||||
if not module[key] then
|
||||
configz.error(string.format("data.%s.%s does not exist", scope, key))
|
||||
return ""
|
||||
end
|
||||
|
||||
return module[key]
|
||||
end
|
||||
|
||||
return data
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
require "modules.bin"
|
||||
require "modules.clojure"
|
||||
require "modules.git"
|
||||
require "modules.lua-lsp"
|
||||
require "modules.nvim"
|
||||
require "modules.nvm"
|
||||
|
|
|
|||
9
modules/git.lua
Normal file
9
modules/git.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
local data = require "lib.data"
|
||||
|
||||
configz.template(os.getenv "HOME" .. "/.gitconfig", {
|
||||
source = os.getenv "PWD" .. "/site-modules/core/templates/gitconfig.liquid",
|
||||
data = {
|
||||
user_name = data.lookup("common", "user_name"),
|
||||
email = data.lookup("personal", "email"),
|
||||
},
|
||||
})
|
||||
40
site-modules/core/templates/gitconfig.liquid
Normal file
40
site-modules/core/templates/gitconfig.liquid
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#
|
||||
# !! DO NOT EDIT !!
|
||||
# !! This file is managed by configz !!
|
||||
#
|
||||
|
||||
[user]
|
||||
name = {{ data.user_name }}
|
||||
email = {{ data.email }}
|
||||
|
||||
[core]
|
||||
editor = nvim
|
||||
autocrlf = input
|
||||
|
||||
[merge]
|
||||
conflictstyle = diff3
|
||||
|
||||
[rerere]
|
||||
enabled = true
|
||||
|
||||
[push]
|
||||
default = current
|
||||
|
||||
[pager]
|
||||
diff = delta
|
||||
log = delta
|
||||
reflog = delta
|
||||
show = delta
|
||||
|
||||
[interactive]
|
||||
diffFilter = delta --color-only
|
||||
|
||||
[delta]
|
||||
line-numbers = true
|
||||
navigate = true
|
||||
hunk-header-style = raw
|
||||
hunk-header-decoration-style = ul
|
||||
file-modified-label = "modified:"
|
||||
file-removed-label = "removed:"
|
||||
file-added-label = "added:"
|
||||
file-renamed-label = "renamed:"
|
||||
Loading…
Reference in a new issue