andreyefgs
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Код: local n = {} local u = {} function removebom(s) s = string.gsub(s, "\239\187\191", "") return s end function getindex(t, v) for i = 1, #t do if t[i] == v then return i end end return 0 end local function ExpandEnv(str) return (str:gsub("%%(.-)%%", win.GetEnv)) end; function readfile() local list = "" local p = ExpandEnv("%FARPROFILE%\\Macros\\utils\\clone_list.txt") local file = io.open(p, "r") io.input(file) while true do local line = io.read() if line == nil then break end line = removebom(line) local name = line:gsub("^.*\47([^\47]+)\46git$", "%1") table.insert(n, name) table.insert(u, line) list = list .. name .. "\n" end return list end local list = readfile() local r = Menu.Show(list, "Github Repositories", nil, 0) if r then local i = getindex(n, r) if u[i] then local cmd = "git clone " .. u[i] panel.SetCmdLine(nil, cmd) Keys "Enter" end end |
|