1
0
Fork 0

nvim: snippets: don't fail if name/email not found

This commit is contained in:
tastytea 2022-08-13 01:25:43 +02:00
parent 2ffd49532d
commit 2f02c47ef0
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 6 additions and 2 deletions

View File

@ -101,8 +101,8 @@ end
function MY_shell_capture(command)
local handle = io.popen(command)
if not handle then return '' end
local result = handle:read() or ''
if not handle then return nil end
local result = handle:read() or nil
handle:close()
return result
end

View File

@ -61,9 +61,11 @@ return {
end),
name = f(function()
return MY_shell_capture('git config user.name')
or 'INSERT_NAME'
end),
email = f(function()
return MY_shell_capture('git config user.email')
or 'INSERT_EMAIL'
end),
cursor = i()
})
@ -85,9 +87,11 @@ return {
end),
name = f(function()
return MY_shell_capture('git config user.name')
or 'INSERT_NAME'
end),
email = f(function()
return MY_shell_capture('git config user.email')
or 'INSERT_EMAIL'
end),
cursor = i()
})