]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
colorize cvarlist and completion nicely
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 29 May 2009 18:53:45 +0000 (18:53 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 29 May 2009 18:53:45 +0000 (18:53 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8997 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c
cvar.c

diff --git a/cmd.c b/cmd.c
index 133865c931aacbe965287f3da20f090dba57b49f..33b3f75f0a8955cee3cccd71c503df4df605eb42 100644 (file)
--- 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 6cc80770a274b79f7318a0713a644887451cd6d7..2aa3e9437ab94a6f97ea6c9ce9fc84fafb17c2f6 100644 (file)
--- 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);
 }