Skip to content

Commit 8802493

Browse files
committed
short option handlers and badly autoformatted code rows now is oneliners
1 parent a499036 commit 8802493

1 file changed

Lines changed: 7 additions & 34 deletions

File tree

empty-bin.lua

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@ local function emptyContainer(container)
1818
print('Emptying ' .. dfhack.items.getReadableDescription(container))
1919
local pos = xyz2pos(dfhack.items.getPosition(container))
2020
for _, item in ipairs(items) do
21-
local skip_liquid =
22-
item:getType() == df.item_type.LIQUID_MISC or
23-
item:getType() == df.item_type.DRINK and not options.liquids
21+
local skip_liquid = item:getType() == df.item_type.LIQUID_MISC or item:getType() == df.item_type.DRINK and not options.liquids
2422
if skip_liquid then
25-
print(
26-
' ' ..
27-
dfhack.items.getReadableDescription(item) ..
28-
' was skipped because the liquid flag was not provided'
29-
)
23+
print(' ' .. dfhack.items.getReadableDescription(item) .. ' was skipped because the liquid flag was not provided')
3024
else
3125
print(' ' .. dfhack.items.getReadableDescription(item))
3226
dfhack.items.moveToGround(item, pos)
@@ -38,32 +32,11 @@ local function emptyContainer(container)
3832
end
3933
end
4034

41-
argparse.processArgsGetopt(
42-
args,
43-
{
44-
{
45-
'h',
46-
'help',
47-
handler = function()
48-
options.help = true
49-
end
50-
},
51-
{
52-
'r',
53-
'recursive',
54-
handler = function()
55-
options.recursive = true
56-
end
57-
},
58-
{
59-
'l',
60-
'liquids',
61-
handler = function()
62-
options.liquids = true
63-
end
64-
}
65-
}
66-
)
35+
argparse.processArgsGetopt(args,{
36+
{ 'h', 'help', handler = function() options.help = true end },
37+
{ 'r', 'recursive', handler = function() options.recursive = true end },
38+
{ 'l', 'liquids', handler = function() options.liquids = true end }
39+
})
6740

6841
if options.help then
6942
print(dfhack.script_help())

0 commit comments

Comments
 (0)