From 8d762458a1fba788888c7b06d971e3ddb927fbc9 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Thu, 20 Mar 2008 16:41:16 +0100 Subject: [PATCH] New config options show-author, show-date, show-refs, show-line-numbers. Signed-off-by: Jonas Fonseca --- tig.c | 30 +++++++++++++++++++++++++++--- tigrc.5.txt | 4 ++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/tig.c b/tig.c index 025a6f8..e5741d6 100644 --- 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; } diff --git a/tigrc.5.txt b/tigrc.5.txt index e73d700..644ebc7 100644 --- a/tigrc.5.txt +++ b/tigrc.5.txt @@ -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 -- 2.32.0.93.g670b81a890