Merge pull request #3090 from myk002/myk_autounsuspend_turndown

turn down autounsuspend gracefully
develop
Myk 2023-03-25 12:34:32 -07:00 committed by GitHub
commit a532012a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 6 deletions

@ -142,4 +142,5 @@ enable \
# Default Aliases # # Default Aliases #
################### ###################
alias add autounsuspend suspendmanager
alias add gui/dig gui/design alias add gui/dig gui/design

@ -26,6 +26,12 @@ Moved frequently used materials to the top of the materials list when building
buildings. Also offered extended options when building constructions. All buildings. Also offered extended options when building constructions. All
functionality has been merged into `buildingplan`. functionality has been merged into `buildingplan`.
.. _autounsuspend:
autounsuspend
=============
Replaced by `suspendmanager`.
.. _combine-drinks: .. _combine-drinks:
combine-drinks combine-drinks

@ -51,6 +51,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `stockpiles`: now includes a library of useful stockpile configs (see docs for details) - `stockpiles`: now includes a library of useful stockpile configs (see docs for details)
- `automelt`: now allows metal chests to be melted (workaround for DF bug 2493 is no longer needed) - `automelt`: now allows metal chests to be melted (workaround for DF bug 2493 is no longer needed)
- `orders`: add minimize button to overlay panel so you can get it out of the way to read long statue descriptions when choosing a subject in the details screen - `orders`: add minimize button to overlay panel so you can get it out of the way to read long statue descriptions when choosing a subject in the details screen
- `enable`: can now interpret aliases defined with the `alias` command
## Documentation ## Documentation

@ -763,6 +763,8 @@ command_result Core::runCommand(color_ostream &con, const std::string &first_, s
} }
} }
part = GetAliasCommand(part, true);
Plugin * plug = (*plug_mgr)[part]; Plugin * plug = (*plug_mgr)[part];
if(!plug) if(!plug)
@ -2657,13 +2659,14 @@ std::map<std::string, std::vector<std::string>> Core::ListAliases()
return aliases; return aliases;
} }
std::string Core::GetAliasCommand(const std::string &name, const std::string &default_) std::string Core::GetAliasCommand(const std::string &name, bool ignore_params)
{ {
std::lock_guard<std::recursive_mutex> lock(alias_mutex); std::lock_guard<std::recursive_mutex> lock(alias_mutex);
if (IsAlias(name)) if (!IsAlias(name) || aliases[name].empty())
return join_strings(" ", aliases[name]); return name;
else if (ignore_params)
return default_; return aliases[name][0];
return join_strings(" ", aliases[name]);
} }
///////////////// /////////////////

@ -173,7 +173,7 @@ namespace DFHack
bool RunAlias(color_ostream &out, const std::string &name, bool RunAlias(color_ostream &out, const std::string &name,
const std::vector<std::string> &parameters, command_result &result); const std::vector<std::string> &parameters, command_result &result);
std::map<std::string, std::vector<std::string>> ListAliases(); std::map<std::string, std::vector<std::string>> ListAliases();
std::string GetAliasCommand(const std::string &name, const std::string &default_ = ""); std::string GetAliasCommand(const std::string &name, bool ignore_params = false);
std::string getHackPath(); std::string getHackPath();