Skip to content

Add output and labels to quickcmd#1534

Open
pajawojciech wants to merge 3 commits intoDFHack:masterfrom
pajawojciech:quickcmd-output-and-labels
Open

Add output and labels to quickcmd#1534
pajawojciech wants to merge 3 commits intoDFHack:masterfrom
pajawojciech:quickcmd-output-and-labels

Conversation

@pajawojciech
Copy link

@pajawojciech pajawojciech commented Jan 8, 2026

Changes

  • Custom names for commands, editable via Shift+N
  • When name is not empty then it shows instead of command
  • Checkbox to display command output in a popup window (Shift+O)
  • Config data is stored in separate config file because data structure changed from string array to objects array (in quickcmd-v2.json instead of quickcmd.json)
  • If there is no data in new config file then auto migrate from old config

quickcmd window:

obraz

Output window:

obraz

Old and new settings file:

obraz

Issues

@ab9rf ab9rf added this to 53.09-r2 Jan 8, 2026
@github-project-automation github-project-automation bot moved this to Todo in 53.09-r2 Jan 8, 2026
@ab9rf ab9rf moved this from Todo to Being worked on in 53.09-r2 Jan 8, 2026
@ab9rf ab9rf removed this from 53.09-r2 Jan 12, 2026
@ab9rf ab9rf added this to 53.10-r2 Jan 12, 2026
@github-project-automation github-project-automation bot moved this to Todo in 53.10-r2 Jan 12, 2026
@ab9rf ab9rf moved this from Todo to Being worked on in 53.10-r2 Jan 12, 2026
@ab9rf ab9rf requested a review from chdoc February 9, 2026 15:11
@ab9rf ab9rf moved this from Being worked on to Review In Progress in 53.10-r2 Feb 9, 2026
Comment on lines +37 to +38
local CONFIG_FILE_OLD = 'dfhack-config/quickcmd.json'
local CONFIG_FILE = 'dfhack-config/quickcmd-v2.json'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ab9rf Is there a policy for updating the configuration format for tools that are not world or site specific? I would tend to keep the configuration filename aligned with the name of the tool without adding any version suffixes, putting any versioning information about the configuration file format into the configuration file itself. That is, back up the old configuration file under a new name and then convert the configuration in place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to agree with you here: keep the file name the same and store the version information into the file itself.

@chdoc chdoc self-requested a review February 10, 2026 18:26
Copy link
Member

@chdoc chdoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think this is a pretty nice change and the code looks pretty clean. Please update the configuration filed behavior as discussed in my previous comment and use a canonical value for commands that do not have assigned names.

end)
screen:dismiss()

local OutputDialog = defclass(OutputDialog, gui.ZScreenModal)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see any compelling reason why the output dialog should be modal. On the contrary, I can definitely see myself looking at the output and then trying to match it to various places inside the fort.

Comment on lines +163 to +168
local title
if self.name and self.name ~= '' then
title = self.name .. ': ' .. self.command
else
title = self.command
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local title
if self.name and self.name ~= '' then
title = self.name .. ': ' .. self.command
else
title = self.command
end
local title = ('%s%s'):format(self.name and self.name .. ': ' or '', self.command)

This assumes that self.name is never actually the empty string, which doesn't make sense in the first place and should probably be enforced by the input dialog

COLOR_GREEN,
self.commands[index].name or '',
function(name)
self.commands[index].name = name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user enters the empty string for the command name, that should probably unset (i.e. set to nil) the name for that command. Otherwise, you have two separate states that you need to treat essentially the same. The other option is to ensure that name is always set, even if it is only set to be the empty string. I think either one is fine, but I don't like to have two different states that basically mean the same and both need to be checked at various places. Either solution is find with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

3 participants