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