MCPcopy Create free account
hub / github.com/DFHack/dfhack / load

Method load

library/Commands.cpp:61–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 }
60
61 command_result Commands::load(color_ostream& con, Core& core, const std::string& first, const std::vector<std::string>& parts)
62 {
63 bool all = false;
64 bool load = (first == "load");
65 bool unload = (first == "unload");
66 bool reload = (first == "reload");
67 auto plug_mgr = core.getPluginManager();
68 if (parts.size())
69 {
70 for (const auto& p : parts)
71 {
72 if (p.size() && p[0] == '-')
73 {
74 if (p.find('a') != std::string::npos)
75 all = true;
76 }
77 }
78 auto ret = CR_OK;
79 if (all)
80 {
81 if (load && !plug_mgr->loadAll())
82 ret = CR_FAILURE;
83 else if (unload && !plug_mgr->unloadAll())
84 ret = CR_FAILURE;
85 else if (reload && !plug_mgr->reloadAll())
86 ret = CR_FAILURE;
87 }
88 else
89 {
90 for (auto& p : parts)
91 {
92 if (p.empty() || p[0] == '-')
93 continue;
94 if (load && !plug_mgr->load(p))
95 ret = CR_FAILURE;
96 else if (unload && !plug_mgr->unload(p))
97 ret = CR_FAILURE;
98 else if (reload && !plug_mgr->reload(p))
99 ret = CR_FAILURE;
100 }
101 }
102 if (ret != CR_OK)
103 con.printerr("{} failed\n", first.c_str());
104 return ret;
105 }
106 else
107 {
108 con.printerr("{}: no arguments\n", first.c_str());
109 return CR_FAILURE;
110 }
111
112 }
113
114 command_result Commands::enable(color_ostream& con, Core& core, const std::string& first, const std::vector<std::string>& parts)
115 {

Callers 11

fIOthreadFunction · 0.45
isSuspendedMethod · 0.45
UpdateMethod · 0.45
getMortalModeMethod · 0.45
handle_signal_internalFunction · 0.45
dfhack_crashlog_threadFunction · 0.45
dfhack_lineedit_syncFunction · 0.45
RunCoreQueryLoopMethod · 0.45
allowedMethod · 0.45
ensureCommandHistoryFunction · 0.45
get_test_statusFunction · 0.45

Calls 9

loadAllMethod · 0.80
unloadAllMethod · 0.80
reloadAllMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.45
findMethod · 0.45
emptyMethod · 0.45
unloadMethod · 0.45
reloadMethod · 0.45

Tested by 1

get_test_statusFunction · 0.36