Skip to content

Commit 65ace24

Browse files
committed
unconditionally tee output to the terminal
so there is a record of the output, and also so that output can be copied, if desired
1 parent 1aae17d commit 65ace24

2 files changed

Lines changed: 26 additions & 24 deletions

File tree

docs/gui/launcher.rst

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,39 @@ gui/launcher
66
:tags: dfhack
77

88
This tool is the primary GUI interface for running DFHack commands. You can open
9-
it from any screen with the \` hotkey. If you opened it by mistake, tap \` again
10-
to close.
9+
it from any screen with the \` hotkey. Tap \` again (or hit :kbd:`Esc`) to
10+
close.
1111

12-
Usage::
12+
Usage
13+
-----
14+
15+
::
1316

1417
gui/launcher [initial commandline]
1518

1619
Examples
1720
--------
1821

19-
- ``gui/launcher``
20-
Opens the launcher dialog with the default help message.
21-
- ``gui/launcher prospect --show ores,veins``
22-
Opens the launcher dialog with the given command visible in the edit area,
23-
ready for modification or running. Commands related to the ``prospect``
24-
command will appear in the autocomplete list, and help text for the
25-
``prospect`` command will be displayed in the help area.
22+
``gui/launcher``
23+
Open the launcher dialog with a blank initial commandline.
24+
``gui/launcher prospect --show ores,veins``
25+
Open the launcher dialog with the edit area pre-populated with the given
26+
command, ready for modification or running. Tools related to ``prospect``
27+
will appear in the autocomplete list, and help text for ``prospect`` will be
28+
displayed in the help area.
2629

2730
Editing and running commands
2831
----------------------------
2932

3033
Enter the command you want to run by typing its name. If you want to start over,
3134
:kbd:`Ctrl`:kbd:`C` will clear the line. When you are happy with the command,
3235
hit :kbd:`Enter` or click on the ``run`` button to run it. Any output from the
33-
command will appear in the help area. If you want to run the command and close
34-
the dialog so you can get back to the game, use :kbd:`Shift`:kbd:`Enter` or hold
35-
down the :kbd:`Shift` key and click on the ``run`` button instead. The dialog
36-
also closes automatically if you run a command that brings up a new GUI screen.
37-
In either case, if the launcher window doesn't come back up to show the command
38-
output, then the command output (if any) will appear in the DFHack terminal
39-
console.
36+
command will appear in the help area. If you want to run the command but close
37+
the dialog immediately so you can get back to the game, use
38+
:kbd:`Shift`:kbd:`Enter` or hold down the :kbd:`Shift` key and click on the
39+
``run`` button instead. The dialog also closes automatically if you run a
40+
command that brings up a new GUI screen. In any case, the command output will
41+
also be written to the DFHack terminal console.
4042

4143
Autocomplete
4244
------------
@@ -67,7 +69,7 @@ Command history
6769
``gui/launcher`` keeps a history of commands you have run to let you quickly run
6870
those commands again. You can scroll through your command history with the
6971
:kbd:`Up` and :kbd:`Down` cursor keys, or you can search your history for
70-
something specific with the :kbd:`Alt`:kbd:`S` hotkey. After you hit
72+
something specific with the :kbd:`Alt`:kbd:`S` hotkey. When you hit
7173
:kbd:`Alt`:kbd:`S`, start typing to search your history for a match. To find the
7274
next match for what you've already typed, hit :kbd:`Alt`:kbd:`S` again. You can
7375
run the matched command immediately with :kbd:`Enter` (or

gui/launcher.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,18 +537,18 @@ local function safe_run(reappear, command, prev_parent_focus)
537537
-- hotkey guards and tools that detect the top viewscreen to work reliably.
538538
script.sleep(2, 'frames')
539539
local output = dfhack.run_command_silent(command)
540+
if #output > 0 then
541+
print('Output from command run from gui/launcher:')
542+
print('> ' .. command)
543+
print()
544+
print(output)
545+
end
540546
-- if we displayed a new dfhack screen, don't come back up even if reappear
541547
-- is true. otherwise, the user can't interact with the new screen. if we're
542548
-- not reappearing with the output, print the output to the console.
543549
local parent_focus = dfhack.gui.getCurFocus(true)
544550
if not reappear or (parent_focus:startswith('dfhack/') and
545551
parent_focus ~= prev_parent_focus) then
546-
if #output > 0 then
547-
print('Output from command run from gui/launcher:')
548-
print('> ' .. command)
549-
print()
550-
print(output)
551-
end
552552
return
553553
end
554554
-- reappear and show the command output

0 commit comments

Comments
 (0)