@@ -49,7 +49,7 @@ namespace DFHack
4949 " See more commands by running 'ls'.\n\n "
5050 );
5151
52- con.print (" DFHack version %s \n " , dfhack_version_desc (). c_str ());
52+ con.print (" DFHack version {} \n " , dfhack_version_desc ());
5353 }
5454 else
5555 {
@@ -100,12 +100,12 @@ namespace DFHack
100100 }
101101 }
102102 if (ret != CR_OK)
103- con.printerr (" %s failed\n " , first.c_str ());
103+ con.printerr (" {} failed\n " , first.c_str ());
104104 return ret;
105105 }
106106 else
107107 {
108- con.printerr (" %s : no arguments\n " , first.c_str ());
108+ con.printerr (" {} : no arguments\n " , first.c_str ());
109109 return CR_FAILURE;
110110 }
111111
@@ -128,7 +128,7 @@ namespace DFHack
128128
129129 if (has_backslashes (part))
130130 {
131- con.printerr (" Replacing backslashes with forward slashes in \" %s \"\n " , part. c_str () );
131+ con.printerr (" Replacing backslashes with forward slashes in \" {} \"\n " , part);
132132 replace_backslashes_with_forwardslashes (part);
133133 }
134134
@@ -146,20 +146,20 @@ namespace DFHack
146146 else
147147 {
148148 res = CR_NOT_FOUND;
149- con.printerr (" No such plugin or Lua script: %s \n " , part. c_str () );
149+ con.printerr (" No such plugin or Lua script: {} \n " , part);
150150 }
151151 }
152152 else if (!plug->can_set_enabled ())
153153 {
154154 res = CR_NOT_IMPLEMENTED;
155- con.printerr (" Cannot %s plugin: %s \n " , first. c_str () , part. c_str () );
155+ con.printerr (" Cannot {} plugin: {} \n " , first, part);
156156 }
157157 else
158158 {
159159 res = plug->set_enabled (con, enable);
160160
161161 if (res != CR_OK || plug->is_enabled () != enable)
162- con.printerr (" Could not %s plugin: %s \n " , first. c_str () , part. c_str () );
162+ con.printerr (" Could not {} plugin: {} \n " , first, part);
163163 }
164164 }
165165
@@ -174,7 +174,7 @@ namespace DFHack
174174 if (!plug->can_be_enabled ()) continue ;
175175
176176 con.print (
177- " %21s %-3s%s \n " ,
177+ " {:>21} {:<3}{} \n " ,
178178 (key + " :" ).c_str (),
179179 plug->is_enabled () ? " on" : " off" ,
180180 plug->can_set_enabled () ? " " : " (controlled internally)"
@@ -189,8 +189,8 @@ namespace DFHack
189189
190190 command_result Commands::plug (color_ostream& con, Core& core, const std::string& first, const std::vector<std::string>& parts)
191191 {
192- constexpr auto header_format = " %30s %10s %4s %8s \n " ;
193- constexpr auto row_format = " %30s %10s %4zu %8s \n " ;
192+ constexpr auto header_format = " {:30} {:10} {:4} {:8} \n " ;
193+ constexpr auto row_format = header_format ;
194194
195195 con.print (header_format, " Name" , " State" , " Cmds" , " Enabled" );
196196
@@ -227,7 +227,7 @@ namespace DFHack
227227 }
228228 con.color (color);
229229 con.print (row_format,
230- plug->getName (). c_str () ,
230+ plug->getName (),
231231 Plugin::getStateDescription (plug->getState ()),
232232 plug->size (),
233233 (plug->can_be_enabled ()
@@ -293,11 +293,11 @@ namespace DFHack
293293 for (const auto & part : parts | std::views::drop (2 ) | std::views::reverse) {
294294 auto spec = KeySpec::parse (keystr, &parse_error);
295295 if (!spec.has_value ()) {
296- con.printerr (" %s \n " , parse_error. c_str () );
296+ con.printerr (" {} \n " , parse_error);
297297 break ;
298298 }
299299 if (!hotkey_mgr->addKeybind (spec.value (), part)) {
300- con.printerr (" Invalid command: '%s '\n " , part. c_str () );
300+ con.printerr (" Invalid command: '{} '\n " , part);
301301 break ;
302302 }
303303 }
@@ -306,7 +306,7 @@ namespace DFHack
306306 for (const auto & part : parts | std::views::drop (1 )) {
307307 auto spec = KeySpec::parse (part, &parse_error);
308308 if (!spec.has_value ()) {
309- con.printerr (" %s \n " , parse_error. c_str () );
309+ con.printerr (" {} \n " , parse_error);
310310 }
311311 if (!hotkey_mgr->removeKeybind (spec.value ())) {
312312 con.printerr (" No matching keybinds to remove\n " );
@@ -317,7 +317,7 @@ namespace DFHack
317317 else if (parts.size () == 2 && parts[0 ] == " list" ) {
318318 auto spec = KeySpec::parse (parts[1 ], &parse_error);
319319 if (!spec.has_value ()) {
320- con.printerr (" %s \n " , parse_error. c_str () );
320+ con.printerr (" {} \n " , parse_error);
321321 return CR_FAILURE;
322322 }
323323 std::vector<std::string> list = hotkey_mgr->listKeybinds (spec.value ());
@@ -326,7 +326,8 @@ namespace DFHack
326326 for (const auto & kb : list)
327327 con << " " << kb << std::endl;
328328 }
329- else {
329+ else
330+ {
330331 con << " Usage:\n "
331332 << " keybinding list <key>\n "
332333 << " keybinding clear <key>[@context]...\n "
@@ -350,15 +351,15 @@ namespace DFHack
350351 std::vector<std::string> cmd (parts.begin () + 2 , parts.end ());
351352 if (!core.AddAlias (name, cmd, parts[0 ] == " replace" ))
352353 {
353- con.printerr (" Could not add alias %s - already exists\n " , name. c_str () );
354+ con.printerr (" Could not add alias {} - already exists\n " , name);
354355 return CR_FAILURE;
355356 }
356357 }
357358 else if (parts.size () >= 2 && (parts[0 ] == " delete" || parts[0 ] == " clear" ))
358359 {
359360 if (!core.RemoveAlias (parts[1 ]))
360361 {
361- con.printerr (" Could not remove alias %s \n " , parts[1 ]. c_str () );
362+ con.printerr (" Could not remove alias {} \n " , parts[1 ]);
362363 return CR_FAILURE;
363364 }
364365 }
@@ -490,10 +491,10 @@ namespace DFHack
490491 {
491492 if (!parts[1 ].size () || (state_script.event == sc_event_id (parts[1 ])))
492493 {
493- con.print (" %s (%s ): %s%s \n " , sc_event_name (state_script.event ). c_str ( ),
494+ con.print (" {} ({} ): {}{} \n " , sc_event_name (state_script.event ),
494495 state_script.save_specific ? " save-specific" : " global" ,
495496 state_script.save_specific ? " <save folder>/raw/" : " <DF folder>/" ,
496- state_script.path . c_str () );
497+ state_script.path );
497498 }
498499 }
499500 return CR_OK;
0 commit comments