Add gpgSign option to git identity helper

This commit is contained in:
Talia 2023-06-12 10:42:42 +02:00
parent e09e3045e8
commit 40cce1e163
2 changed files with 1 additions and 84 deletions

View file

@ -1,83 +0,0 @@
#!/usr/bin/env lua
local arrr = require 'arrr'
local options do
local parse = arrr {
{ "Enable coloured output", "--colour", "-c" };
{ "Display hidden files", "--hidden", "-h" };
}
options = parse {...}
local inspect = require 'inspect'
end
local structure = {}
for line in io.stdin:lines() do
local dir = structure
for segment in line:gmatch("[^/]+") do
if not dir[segment] then dir[segment] = {} end
dir = dir[segment]
end
end
local function reshape(input, name)
local output = {name = name}
for key, value in pairs(input) do
if options.hidden or not key:find("^%..+") then
table.insert(output, reshape(value, key))
end
end
table.sort(output, function(a, b)
return a.name < b.name
end)
return output
end
structure = reshape(structure)
local escape do
if options.colour then
function escape(num, str)
return string.format("\x1b[%im%s\x1b[%im", num, str, 0)
end
else
function escape(num, str)
return str
end
end
end
local function line(line)
return escape(37, line)
end
local function name(tab)
local name = tab.name or '.'
if #tab > 0 then
return escape(33, name)
else
return escape(0, name)
end
end
local function draw(tab, prefix, first)
prefix = prefix or ''
first = first or ''
print(first .. name(tab))
for index, path in ipairs(tab) do
local new do
if index < #tab then
draw(path, prefix .. line'│ ', prefix .. line'├──')
else
draw(path, prefix .. line' ', prefix .. line'└──')
end
end
end
end
for i, value in ipairs(structure) do
draw(value)
end

View file

@ -25,7 +25,7 @@
h = log -1 --format=%h
hash = log -1 --format=%H
head = log -1 --show-signature --format=fuller
identity = "! git config user.name \"$(git config user.$1.name)\"; git config user.email \"$(git config user.$1.email)\"; :"
identity = "! git config user.name \"$(git config user.$1.name)\"; git config user.email \"$(git config user.$1.email)\"; git config commit.gpgSign \"$(git config user.$1.gpgSign)\"; :"
root = rev-parse --show-toplevel
stat = log --oneline --stat --date-order
task = "! TASKDATA=$(git rev-parse --show-toplevel)/.git/task task"