diff options
Diffstat (limited to 'minecctl/minecctl.c')
-rw-r--r-- | minecctl/minecctl.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/minecctl/minecctl.c b/minecctl/minecctl.c index c2d6c19..51b106b 100644 --- a/minecctl/minecctl.c +++ b/minecctl/minecctl.c @@ -136,7 +136,7 @@ void dump_config(struct cfg *cfg) info("│ rcon_addrstr : %s", cfg->rcon_addrstr); info("│ mc_addrstr : %s", cfg->mc_addrstr); info("│ cmd : %p", cfg->cmd); - info("│ force stop : %s", cfg->force_stop ? "yes" : "no"); + info("│ force : %s", cfg->force ? "yes" : "no"); info("│ default set : %s", cfg->default_set ? "yes" : "no"); info("│ servers loaded: %s", cfg->server_list_loaded ? "yes" : "no"); info("│ commands%s", cfg->commands ? "" : " : none"); @@ -158,6 +158,7 @@ _noreturn_ static void usage(bool no_error) "Valid commands:\n" " init perform initial setup\n" " new SERVER create a new server\n" + " delete SERVER delete a server (-f to delete world as well)\n" " list list known servers\n" " lint check validity of server configuration files\n" " info [SERVER] show information about a running SERVER (or all known servers)\n" @@ -179,7 +180,7 @@ _noreturn_ static void usage(bool no_error) " -m, --mc-address=ADDR connect to Minecraft server at ADDR\n" " (only relevant for some commands, can also\n" " use environment variable MC_ADDRESS)\n" - " -f, --force stop server even if it has players\n" + " -f, --force force stop/delete actions\n" " -v, --verbose enable extra logging\n" " -d, --debug enable debugging information\n" " -h, --help print this information\n" @@ -335,6 +336,17 @@ static void parse_command(struct cfg *cfg, char *const *argv) cfg->commands = strv_copy(argv); cfg->cmd = do_new; break; + case CMD_DELETE: + if (!*argv) { + error("Missing arguments"); + usage(false); + } else if (*(argv + 1)) { + error("Too many arguments"); + usage(false); + } + cfg->commands = strv_copy(argv); + cfg->cmd = do_delete; + break; case CMD_LIST: if (*argv) { error("Too many arguments"); @@ -460,7 +472,7 @@ static void parse_cmdline(struct cfg *cfg, int argc, char *const *argv) debug_mask = ~0; break; case 'f': - cfg->force_stop = true; + cfg->force = true; break; case 'h': usage(true); |