Commits

Greg Ward  committed ce1a95c

Ensure consistent order of format specifiers: %n, %b, %r, %p, %u, %m, %%.

  • Participants
  • Parent commits 7baa05a

Comments (0)

Files changed (2)

File src/vcprompt.c

                 printf("usage: %s [-h] [-d] [-t timeout_ms] [-f FORMAT]\n", argv[0]);
                 printf("FORMAT (default=\"%s\") may contain:\n%s",
                 DEFAULT_FORMAT,
-                " %b  show branch\n"
-                " %r  show revision\n"
-                " %p  show patch name (MQ, guilt, ...)\n"
-                " %u  show unknown\n"
-                " %m  show modified\n"
-                " %n  show VC name\n"
-                " %%  show '%'\n"
+                "  %n  show VC name\n"
+                "  %b  show branch\n"
+                "  %r  show revision\n"
+                "  %p  show patch name (MQ, guilt, ...)\n"
+                "  %u  indicate unknown (untracked) files\n"
+                "  %m  indicate uncommitted changes (modified/added/removed)\n"
+                "  %%  show '%'\n"
                 );
                 printf("Environment Variables:\n"
-                " VCPROMPT_FORMAT\n"
+                "  VCPROMPT_FORMAT\n"
                 );
                 exit(1);
         }
             switch (format[i]) {
                 case '\0':              /* at end of string: ignore */
                     break;
+                case 'n':               /* name of VC system */
+                    break;
                 case 'b':
                     options->show_branch = 1;
                     break;
                 case 'm':
                     options->show_modified = 1;
                     break;
-                case 'n':               /* name of VC system */
                 case '%':
                     break;
                 default:
             i++;
             switch (format[i]) {
                 case '0':               /* end of string */
-                case '%':               /* escaped % */
-                    putc('%', stdout);
+                    break;
+                case 'n':
+                    fputs(context->name, stdout);
                     break;
                 case 'b':
                     if (result->branch != NULL)
                     if (result->modified)
                         putc('+', stdout);
                     break;
-                case 'n':
-                    fputs(context->name, stdout);
+                case '%':               /* escaped % */
+                    putc('%', stdout);
                     break;
                 default:                /* %x printed as x */
                     putc(format[i], stdout);
 expands to some piece of information about the current working dir.
 The supported format specifiers are:
 .TP
+.B %n
+A short all-lowercase name for the version control system managing the
+working dir: e.g. "cvs", "svn", "hg", "git", "fossil".
+.TP
 .B %b
 The name of the current branch.
 .TP
 a single "+" if there are any uncommitted changes (modified, added, or
 removed files) in the working dir. Slow.
 .TP
-.B %n
-A short all-lowercase name for the version control system managing the
-working dir: e.g. "cvs", "svn", "hg", "git", "fossil".
-.TP
 .B %%
 A single "%" character.
 .PP
 is not yet implemented.
 
 Format specifier
+.B %u
+is supported by running "git ls-files --others --exclude-standard", so
+it can be expensive in a large working dir.
+
+Format specifier
 .B %m
 is supported by running "git diff --no-ext-diff --quiet --exit-code",
 so it can be expensive in a large working dir.
 
-Format specifier
-.B %u
-is supported by running "git ls-files --others --exclude-standard", so
-it can be expensive in a large working dir.
-
 The timeout (-t) option is useful to prevent
 .B vcprompt
 from taking too long in large working dirs.
 is implemented by reading MQ internals.
 
 Format specifiers
+.B %u
+and
 .B %m
-and
-.B %u
 are not implemented.
 
 .SH SUBVERSION (SVN) SUPPORT
 is not implemented (it makes no sense with Subversion).
 
 Format specifiers
+.B %u
+and
 .B %m
-and
-.B %u
 are not implemented.
 
 .SH CVS SUPPORT
 if that file does not exist,
 .B vcprompt
 displays the branch as "trunk".
-
 .B vcprompt
 looks only in the current dir, not in any subdirectories, so it will
 not notice mixed-branch working dirs.
 is not implemented (it makes no sense with CVS).
 
 Format specifiers
+.B %u
+and
 .B %m
-and
-.B %u
 are not supported because CVS has no easy way to get that
 information.