Skip to content

Document keybinds in dfhack.init-example#972

Merged
lethosor merged 2 commits intoDFHack:developfrom
PeridexisErrant:doc-keybinds
Oct 23, 2016
Merged

Document keybinds in dfhack.init-example#972
lethosor merged 2 commits intoDFHack:developfrom
PeridexisErrant:doc-keybinds

Conversation

@PeridexisErrant
Copy link
Copy Markdown
Contributor

@PeridexisErrant PeridexisErrant commented Aug 2, 2016

Closes issue #971 - DFHack/scripts#5 is the complementary pull.

This pull:

  • adds a new directive to Sphinx, for keybindings, with most information pulled from dfhack.init-example
  • automatically adds the directive to script documentation if there is a keybinding at build time
  • adds the directive to plugin docs as appropriate (by hand)
  • causes a build of the docs to fail if there is an undocumented keybinding, and warns if a documented keybinding no longer exists (which also fails the Travis build)
  • updates NEWS.rst, including for dwarfvet
  • removes an obsolete special case from autodump (since keybinds may now have spaces in the command if quoted). Further work, to remove the autodump-destroy-item case, would be welcome but is beyond my C++ skills.

@PeridexisErrant
Copy link
Copy Markdown
Contributor Author

@lethosor - any idea why Travis is silent?

@lethosor
Copy link
Copy Markdown
Member

lethosor commented Aug 3, 2016

It was disabled temporarily because of the current state of the develop branch (e.g. the ruby plugin won't compile anywhere, besides the issues on Windows addressed in another PR). I'll see if there's a better way to check PRs, but I doubt this PR would pass the compilation stage. I can definitely test this locally, though (although it might be a couple days).

@PeridexisErrant
Copy link
Copy Markdown
Contributor Author

PeridexisErrant commented Aug 12, 2016

Rebased on develop to fix merge conflicts, added a commit to improve docs/Core.rst wrt use of DFHack commands and document the new syntax from #767.

docs/Core.rst Outdated

There are two ways to run DFHack commands from an OS terminal.

* If DF and DFHack are already running, calling ``dfhack-run my command``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be ./dfhack-run on *nix

@lethosor
Copy link
Copy Markdown
Member

lethosor commented Aug 12, 2016

autodump-destroy-here is actually slightly different from autodump destroy-here (although I thought they were the same myself until now) - the former uses Gui::cursor_hotkey, so DFHack will never even attempt to call it if a cursor isn't available. With the latter bound to a hotkey, you'll get an error logged to the console if you press Ctrl-Shift-K, which is an issue if you have Ctrl-Shift-K bound to another command that works in another UI state.

Incidentally, you do get an error if you run either version from the console. As far as I know, plugin commands can't detect whether they're invoked by a keybinding (only the DFHack core can), so merging the logic into autodump_main and making it silent when invoked as a keybinding isn't possible. Even if it were, it's easier to delegate the task of determining whether the UI state is valid to the hotkey guards (Gui::cursor_hotkey, Gui::any_item_hotkey, etc.).

Anyway, thanks for documenting the +-style arguments - that showed up in 5-ish changelogs around 0.43.03, so I must have assumed it was documented already, but apparently not. :)

@PeridexisErrant
Copy link
Copy Markdown
Contributor Author

PeridexisErrant commented Aug 13, 2016

OK, looks like the core docs need some extra work - I'll split that out into a new pull request. I'll also remove the autodump changes, and squash the rest for clarity.

The good news is that Dwarf Fortress.exe" +devel/print-args test1 +devel/print-args test2 prints test1 and test2, working as expected and with multiple commands (which I'll now document).

conf.py Outdated
import fnmatch
from io import open
from itertools import starmap
from functools import lru_cache
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't implemented in Python 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like the only two things this is used for are zero-argument functions, so it might as well be replaced with a simple memoize/cache decorator.

@PeridexisErrant
Copy link
Copy Markdown
Contributor Author

Rebased on develop to remove merge conflict in NEWS.rst, and removed use of lru_cache (again).

@PeridexisErrant
Copy link
Copy Markdown
Contributor Author

@lethosor - I've fixed the merge conflict, any other blockers?

@lethosor
Copy link
Copy Markdown
Member

I've been dealing with OS upgrades and changes to Lua GUI scripts/hooks for a few days here, and I'll probably be busy in real life later this week. Sorry for the timing being somewhat inconvenient, but I'll get to this when I have time. No need to delete/recreate the comment to notify me again - I do check the list of PRs periodically, and definitely before releases.

@PeridexisErrant
Copy link
Copy Markdown
Contributor Author

Sorry - just checking that it wasn't a problem that I needed to fix.

(I've also added a commit to expand the workNow docs, per a request via Reddit PM)

@PeridexisErrant
Copy link
Copy Markdown
Contributor Author

Rebased to fix merge conflict in NEWS.rst

@lethosor lethosor merged commit f170b70 into DFHack:develop Oct 23, 2016
lethosor added a commit that referenced this pull request Oct 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants