Merge branch 'master' of git://repo.or.cz/git-gui
[git] / builtin-runstatus.c
1 #include "cache.h"
2 #include "wt-status.h"
3
4 extern int wt_status_use_color;
5
6 static const char runstatus_usage[] =
7 "git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]";
8
9 int cmd_runstatus(int argc, const char **argv, const char *prefix)
10 {
11         struct wt_status s;
12         int i;
13
14         git_config(git_status_config);
15         wt_status_prepare(&s);
16
17         for (i = 1; i < argc; i++) {
18                 if (!strcmp(argv[i], "--color"))
19                         wt_status_use_color = 1;
20                 else if (!strcmp(argv[i], "--nocolor"))
21                         wt_status_use_color = 0;
22                 else if (!strcmp(argv[i], "--amend")) {
23                         s.amend = 1;
24                         s.reference = "HEAD^1";
25                 }
26                 else if (!strcmp(argv[i], "--verbose"))
27                         s.verbose = 1;
28                 else if (!strcmp(argv[i], "--untracked"))
29                         s.untracked = 1;
30                 else
31                         usage(runstatus_usage);
32         }
33
34         wt_status_print(&s);
35         return s.commitable ? 0 : 1;
36 }