DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.87k stars 475 forks source link

autonick does not listen for "help" or "-help" args #2050

Closed doublestrafe closed 2 years ago

doublestrafe commented 2 years ago

autonick immediately runs and changes nicknames of all un-nicked dwarves when run with any arguments. This behavior is inconsistent with all other dfhack scripts and utilities, which generally accept "help" or "-help" to give detail about what the command does and how to use it. This leads to new users finding themselves with all their dwarves renamed, with no confirmation, and no way to change them back automatically.

Suggested remediations:

Moth-Tolias commented 2 years ago

whoops, my bad. will address this tomorrow if i'm able.

Moth-Tolias commented 2 years ago

after a cursory look at some other scripts to see what the best practices might be, a majority seem to ignore -h / -help arguments. drain-aquifer runs destructively without complaint while fillneeds errors with a stack trace, for example. neither display help. i'll continue working on autonick, but it might be worth going through the list of scripts more thoroughly and documenting which ones need the same treatment.

myk002 commented 2 years ago

Agreed. Here's an example of a script that handles various forms of the "help" parameter and might be a good example to follow: https://github.com/DFHack/scripts/blob/master/prioritize.lua#L534

It handles "-h", "--help", and "help". It might work for "-help" too since that's the same as "-h -e -l -p" and "-h" is the first param that is processed.