diff --git a/docs/fix/stuck-worship.rst b/docs/fix/stuck-worship.rst index c4bccc055..2854be122 100644 --- a/docs/fix/stuck-worship.rst +++ b/docs/fix/stuck-worship.rst @@ -26,7 +26,26 @@ another task. Usage ----- +:: + + fix/stuck-worship [] + +Reshuffle prayer needs of units in the fort. + +Examples +-------- + ``fix/stuck-worship`` - Rebalance prayer needs of units in the fort. -``fix/stuck-worship -v``, ``fix/stuck-worship --verbose`` - Rebalance prayer needs of units in the fort. Print names of affected units. + Rebalance prayer needs and print the total number of affected units. +``fix/stuck-worship -v`` + Same as above, but also print the names of all affected units. + +Options +------- + +``-v``, ``--verbose`` + Print the names of all affected units. +``-q``, ``--quiet`` + Don't print the number of affected units if it's zero. Intended for + automatic use. + diff --git a/fix/stuck-worship.lua b/fix/stuck-worship.lua index 0222dd6fe..2d4880914 100644 --- a/fix/stuck-worship.lua +++ b/fix/stuck-worship.lua @@ -1,8 +1,9 @@ local argparse = require('argparse') -local verbose = false +local verbose, quiet = false, false argparse.processArgsGetopt({...}, { {'v', 'verbose', handler=function() verbose = true end}, + {'q', 'quiet', handler=function() quiet = true end}, }) local function for_pray_need(needs, fn) @@ -106,6 +107,6 @@ for _,unit in ipairs(dfhack.units.getCitizens(false, true)) do ::next_unit:: end -if verbose or count > 0 then +if not quiet or count > 0 then print(('Rebalanced prayer needs for %d units.'):format(count)) end diff --git a/internal/control-panel/registry.lua b/internal/control-panel/registry.lua index 4e0bdd2e6..7dca4d2b0 100644 --- a/internal/control-panel/registry.lua +++ b/internal/control-panel/registry.lua @@ -90,7 +90,7 @@ COMMANDS_BY_IDX = { desc='Fix activity references on stuck instruments to make them usable again.', params={'--time', '1', '--timeUnits', 'days', '--command', '[', 'fix/stuck-instruments', ']'}}, {command='fix/stuck-worship', group='bugfix', mode='repeat', default=true, - params={'--time', '1', '--timeUnits', 'days', '--command', '[', 'fix/stuck-worship', ']'}}, + params={'--time', '1', '--timeUnits', 'days', '--command', '[', 'fix/stuck-worship', '-q', ']'}}, {command='fix/noexert-exhaustion', group='bugfix', mode='repeat', default=true, params={'--time', '439', '--timeUnits', 'ticks', '--command', '[', 'fix/noexert-exhaustion', ']'}}, {command='flask-contents', help_command='tweak', group='bugfix', mode='tweak', default=true,