Commit d2278033 authored by mcmodder's avatar mcmodder
Browse files

Продолжаем разговор

parent bf9fda1c
Pipeline #180 passed with stage
in 36 seconds
......@@ -90,4 +90,83 @@ local function getInstalledPackages()
error("Can't write /etc/pacman/installed file!")
end
end
end
----------------------------
--[[begin]]
----------------------------
local foundArgs = 0
for _,value in pairs({"Q","S","R", "query", "remove", "sync"}) do if ops[value] then foundArgs=foundArgs+1 end end
if foundArgs > 1 then
print("Please use -S, -R or -Q, not all at one time")
end
if foundArgs ~= 1 or ops.h or ops.help then
--help
print("pacman {-Q --query} [options] [package(s)]")
print("pacman {-R --remove} [options] <package(s)>")
print("pacman {-S --sync} [options] [package(s)]")
print("Options:")
print("-s - search")
print("-i - information")
print("-d - ignore dependencies")
print("-u - update")
print("-y - force 'Y' answer")
print("-f - flash package to EEPROM")
os.exit()
end
foundArgs=nil
local repos, default = fetchRepos()
local installed = getInstalledPackages()
if ops.Q or ops.query then
for _,value in pairs({"d","u","y"}) do if ops[value] then print("You can't use -"..value.." with -Q, it'll be ignored")
local foundArgs = 0
for _,value in pairs({"s","i","f"}) do if ops[value] then foundArgs=foundArgs+1 end end
if foundArgs > 1 then
print("Please use -s, -i or -f, not all at one time")
os.exit()
end
if ops.s then
if #args == 0 then
for package,data in pairs(installed) do
print("local/"..package.." "..data.version)
if data.desc then print(" "..data.desc) end
end
else
local foundPackages = {}
for package in pairs(installed) do
local found = 0
for _,word in pairs(args) do
if package:find(word) or (installed[package].desc and installed[package].desc:find(word)) then found=found+1 end
end
if found == #args then
table.insert(foundPackages, package)
end
end
for _,package in pairs(foundPackages) do
print("local/"..package.." "..installed[package].version)
if installed[package].desc then print(" "..installed[package].desc) end
end
end
elseif ops.i then
for _,arg in pairs(args) do
if installed[arg] then
--something
print("INDEV")
else
print("Error: package "..arg.." not found")
end
end
elseif ops.f then
else
end
elseif ops.S or ops.sync then
elseif ops.R or ops.remove then
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment