Allow multiple -u flags

This commit is contained in:
Shy 2024-08-22 22:31:31 +02:00
parent c7f4a01401
commit 224fba34bb

13
c4mate
View file

@ -136,8 +136,7 @@ sed -n '
T fail
b
:fail
q 1
']=], self.CURL_FLAGS, self.HOST, url_encode(self.USER), datefile))
q 1 ']=], self.CURL_FLAGS, self.HOST, url_encode(self.USER), datefile))
while true do
local entry = {}
@ -242,8 +241,7 @@ sed -n --sandbox '
T fail
b
:fail
q 1
']=], self.CURL_FLAGS, self.HOST))
q 1 ']=], self.CURL_FLAGS, self.HOST))
while true do
local item = {}
@ -311,10 +309,11 @@ Add or subtract credits:
c4mate <difference>
Give credits:
c4mate -g <amount> <user> [<reason>]]=])
return
os.exit(0)
end
-- Parse -u flag.
elseif arg[1] == "-u" then
-- Parse -u flag (which may be given multiple times).
while arg[1] == "-u" do
table.remove(arg, 1)
USER = arg[1]
table.remove(arg, 1)