From: divverent Date: Fri, 29 May 2009 18:53:45 +0000 (+0000) Subject: colorize cvarlist and completion nicely X-Git-Tag: xonotic-v0.1.0preview~1623 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=c15009fb2a81279504c49b77cacf58568e10e701 colorize cvarlist and completion nicely git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8997 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cmd.c b/cmd.c index 133865c9..33b3f75f 100644 --- a/cmd.c +++ b/cmd.c @@ -1090,33 +1090,31 @@ static void Cmd_Apropos_f(void) } count = 0; - Con_Printf("Cvars:\n"); for (cvar = cvar_vars; cvar; cvar = cvar->next) { - if (!matchpattern_with_separator(cvar->name, partial, false, "", false)) - if (!matchpattern_with_separator(cvar->description, partial, false, "", false)) + if (!matchpattern_with_separator(cvar->name, partial, true, "", false)) + if (!matchpattern_with_separator(cvar->description, partial, true, "", false)) continue; - Con_Printf("^3%s^7: %s\n", cvar->name, cvar->description); + Con_Printf("cvar ^3%s^7: %s\n", cvar->name, cvar->description); count++; } - Con_Printf("Commands:\n"); for (cmd = cmd_functions; cmd; cmd = cmd->next) { - if (!matchpattern_with_separator(cmd->name, partial, false, "", false)) - if (!matchpattern_with_separator(cmd->description, partial, false, "", false)) + if (!matchpattern_with_separator(cmd->name, partial, true, "", false)) + if (!matchpattern_with_separator(cmd->description, partial, true, "", false)) continue; - Con_Printf("^3%s^7: %s\n", cmd->name, cmd->description); + Con_Printf("command ^2%s^7: %s\n", cmd->name, cmd->description); count++; } - Con_Printf("Aliases:\n"); for (alias = cmd_alias; alias; alias = alias->next) { - if (!matchpattern_with_separator(alias->name, partial, false, "", false)) - if (!matchpattern_with_separator(alias->value, partial, false, "", false)) + if (!matchpattern_with_separator(alias->name, partial, true, "", false)) + if (!matchpattern_with_separator(alias->value, partial, true, "", false)) continue; - Con_Printf("^3%s^7: %s", alias->name, alias->value); + Con_Printf("alias ^5%s^7: %s", alias->name, alias->value); count++; } + Con_Printf("%i result%s\n\n", count, (count > 1) ? "s" : ""); } /* @@ -1434,7 +1432,7 @@ void Cmd_CompleteCommandPrint (const char *partial) // Loop through the command list and print all matches for (cmd = cmd_functions; cmd; cmd = cmd->next) if (!strncasecmp(partial, cmd->name, len)) - Con_Printf("%s : %s\n", cmd->name, cmd->description); + Con_Printf("^2%s^7: %s\n", cmd->name, cmd->description); } /* @@ -1472,7 +1470,7 @@ void Cmd_CompleteAliasPrint (const char *partial) // Loop through the alias list and print all matches for (alias = cmd_alias; alias; alias = alias->next) if (!strncasecmp(partial, alias->name, len)) - Con_Printf("%s : %s\n", alias->name, alias->value); + Con_Printf("^5%s^7: %s", alias->name, alias->value); } diff --git a/cvar.c b/cvar.c index 6cc80770..2aa3e943 100644 --- a/cvar.c +++ b/cvar.c @@ -220,7 +220,7 @@ void Cvar_CompleteCvarPrint (const char *partial) // Loop through the command list and print all matches for (cvar = cvar_vars; cvar; cvar = cvar->next) if (!strncasecmp(partial, cvar->name, len)) - Con_Printf ("%c3%s%s : \"%s\" (\"%s\") : %s\n", STRING_COLOR_TAG, cvar->name, STRING_COLOR_DEFAULT_STR, cvar->string, cvar->defstring, cvar->description); + Con_Printf ("^3%s^7 is \"%s\" [\"%s\"] %s\n", cvar->name, cvar->string, cvar->defstring, cvar->description); }