initial
This commit is contained in:
commit
5931cb012f
9 changed files with 900 additions and 0 deletions
23
lua/django/helpers.lua
Normal file
23
lua/django/helpers.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
local plen_status_ok, _ = pcall(require, "plenary")
|
||||
if not plen_status_ok then return end
|
||||
|
||||
local M = {}
|
||||
local Path = require "plenary.path"
|
||||
|
||||
function M.get_path(str) return str:match "(.*[/\\])" end
|
||||
|
||||
function M.add_trailing_slash(value)
|
||||
if value:sub(-1) ~= Path.path.sep then return value .. Path.path.sep end
|
||||
return value
|
||||
end
|
||||
|
||||
function M.split(inputstr, sep)
|
||||
if sep == nil then sep = Path.path.sep end
|
||||
local t = {}
|
||||
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue