Code

New config options show-author, show-date, show-refs, show-line-numbers.
authorDominik Vogt <dvogt@ffm.tc.iot.dtag.de>
Thu, 20 Mar 2008 15:41:16 +0000 (16:41 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Thu, 20 Mar 2008 17:59:54 +0000 (18:59 +0100)
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
tig.c
tigrc.5.txt

diff --git a/tig.c b/tig.c
index 025a6f8547c163ccbec81c2764e149410cc1b52b..e5741d6125aefaa5c0897294c966a4eb699e7938 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -1126,6 +1126,12 @@ option_color_command(int argc, char *argv[])
        return OK;
 }
 
+static bool parse_bool(const char *s)
+{
+       return (!strcmp(s, "1") || !strcmp(s, "true") ||
+               !strcmp(s, "yes")) ? TRUE : FALSE;
+}
+
 /* Wants: name = value */
 static int
 option_set_command(int argc, char *argv[])
@@ -1140,10 +1146,28 @@ option_set_command(int argc, char *argv[])
                return ERR;
        }
 
+       if (!strcmp(argv[0], "show-author")) {
+               opt_author = parse_bool(argv[2]);
+               return OK;
+       }
+
+       if (!strcmp(argv[0], "show-date")) {
+               opt_date = parse_bool(argv[2]);
+               return OK;
+       }
+
        if (!strcmp(argv[0], "show-rev-graph")) {
-               opt_rev_graph = (!strcmp(argv[2], "1") ||
-                                !strcmp(argv[2], "true") ||
-                                !strcmp(argv[2], "yes"));
+               opt_rev_graph = parse_bool(argv[2]);
+               return OK;
+       }
+
+       if (!strcmp(argv[0], "show-refs")) {
+               opt_show_refs = parse_bool(argv[2]);
+               return OK;
+       }
+
+       if (!strcmp(argv[0], "show-line-numbers")) {
+               opt_line_number = parse_bool(argv[2]);
                return OK;
        }
 
index e73d7002ad9b454fa0884f4b33b771d41018e147..644ebc7dba52eb46d429c4a74b035f8ac352cd27 100644 (file)
@@ -42,7 +42,11 @@ is:
 Examples:
 
 --------------------------------------------------------------------------
+set show-author = yes          # Show author?
+set show-date = yes            # Show commit date?
 set show-rev-graph = yes       # Show revision graph?
+set show-refs = yes            # Show references?
+set show-line-numbers = no     # Show line numbers?
 set line-number-interval = 5   # Interval between line numbers
 set tab-size = 8               # Number of spaces per tab
 set encoding = "UTF-8"         # Commit encoding