From 62739f7477758714cba752ce5b044f499e8fe863 Mon Sep 17 00:00:00 2001 From: master-spike Date: Mon, 28 Oct 2024 00:40:59 +0000 Subject: [PATCH] justice: implement code review suggestions --- docs/justice.rst | 11 ++++++----- justice.lua | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/justice.rst b/docs/justice.rst index 4334f5057b..e5ff93cbcb 100644 --- a/docs/justice.rst +++ b/docs/justice.rst @@ -2,23 +2,24 @@ justice ======= .. dfhack-tool:: - :summary: Commands related to the justice system + :summary: Commands related to the justice system. :tags: fort armok units This tool allows control over aspects of the justice system, such as the ability to pardon criminals. -usage +Usage ----- :: justice pardon [--unit ] -Pardon the selected unit or the one specified by unit id if provided. Currently -only applies to prison time and doesn't cancel beatings or hammerings. +Pardon the selected unit or the one specified by unit id (if provided). +Currently only applies to prison time and doesn't cancel beatings or +hammerings. -options +Options ------- ``-u``, ``--unit `` diff --git a/justice.lua b/justice.lua index f86b4fbed4..bfefe52f02 100644 --- a/justice.lua +++ b/justice.lua @@ -35,6 +35,8 @@ local command = positionals[1] if command == "pardon" then command_pardon(unit_id) +elseif not command then + qerror('Missing command') +else + qerror(("Unrecognised command: %s"):format(command)) end - -qerror(("Unrecognised command: %s"):format(command))