nvim: snippets: don't fail if name/email not found
This commit is contained in:
parent
2ffd49532d
commit
2f02c47ef0
|
@ -101,8 +101,8 @@ end
|
||||||
|
|
||||||
function MY_shell_capture(command)
|
function MY_shell_capture(command)
|
||||||
local handle = io.popen(command)
|
local handle = io.popen(command)
|
||||||
if not handle then return '' end
|
if not handle then return nil end
|
||||||
local result = handle:read() or ''
|
local result = handle:read() or nil
|
||||||
handle:close()
|
handle:close()
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,9 +61,11 @@ return {
|
||||||
end),
|
end),
|
||||||
name = f(function()
|
name = f(function()
|
||||||
return MY_shell_capture('git config user.name')
|
return MY_shell_capture('git config user.name')
|
||||||
|
or 'INSERT_NAME'
|
||||||
end),
|
end),
|
||||||
email = f(function()
|
email = f(function()
|
||||||
return MY_shell_capture('git config user.email')
|
return MY_shell_capture('git config user.email')
|
||||||
|
or 'INSERT_EMAIL'
|
||||||
end),
|
end),
|
||||||
cursor = i()
|
cursor = i()
|
||||||
})
|
})
|
||||||
|
@ -85,9 +87,11 @@ return {
|
||||||
end),
|
end),
|
||||||
name = f(function()
|
name = f(function()
|
||||||
return MY_shell_capture('git config user.name')
|
return MY_shell_capture('git config user.name')
|
||||||
|
or 'INSERT_NAME'
|
||||||
end),
|
end),
|
||||||
email = f(function()
|
email = f(function()
|
||||||
return MY_shell_capture('git config user.email')
|
return MY_shell_capture('git config user.email')
|
||||||
|
or 'INSERT_EMAIL'
|
||||||
end),
|
end),
|
||||||
cursor = i()
|
cursor = i()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user