From c55c4bf254d59c4e943d5559cd6e062652751e36 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 4 Feb 2017 21:33:36 +0300 Subject: [PATCH] rename showinfo option to info Related to #39. --- comp.go | 2 +- doc.go | 8 ++++---- docstring.go | 8 ++++---- etc/lfrc.example | 16 ++++++++-------- eval.go | 6 +++--- eval_test.go | 12 ++++++------ opts.go | 4 ++-- ui.go | 4 ++-- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/comp.go b/comp.go index a612e82..e070d6f 100644 --- a/comp.go +++ b/comp.go @@ -68,7 +68,7 @@ var ( "sortby", "timefmt", "ratios", - "showinfo", + "info", } ) diff --git a/doc.go b/doc.go index 913c1ec..3a330e9 100644 --- a/doc.go +++ b/doc.go @@ -61,7 +61,7 @@ The following options can be used to customize the behavior of lf: sortby string (default "natural") timefmt string (default "Mon Jan _2 15:04:05 2006") ratios string (default "1:2:3") - showinfo string (default "") + info string (default "") The following variables are exported for shell commands: @@ -137,19 +137,19 @@ You can delete an existing command by leaving the expression empty: If there is no prefix then ":" is assumed: - map zt set showinfo time + map zt set info time An explicit ":" could be provided to group statements until a "\n" occurs which is especially useful for "map" and "cmd" commands: - map st :set sortby time; set showinfo time + map st :set sortby time; set info time If you need multiline you can wrap statements in "{{" and "}}" after the proper prefix. map st :{{ set sortby time - set showinfo time + set info time }} Mappings diff --git a/docstring.go b/docstring.go index 1d128ac..50ead43 100644 --- a/docstring.go +++ b/docstring.go @@ -65,7 +65,7 @@ The following options can be used to customize the behavior of lf: sortby string (default "natural") timefmt string (default "Mon Jan _2 15:04:05 2006") ratios string (default "1:2:3") - showinfo string (default "") + info string (default "") The following variables are exported for shell commands: @@ -144,19 +144,19 @@ You can delete an existing command by leaving the expression empty: If there is no prefix then ":" is assumed: - map zt set showinfo time + map zt set info time An explicit ":" could be provided to group statements until a "\n" occurs which is especially useful for "map" and "cmd" commands: - map st :set sortby time; set showinfo time + map st :set sortby time; set info time If you need multiline you can wrap statements in "{{" and "}}" after the proper prefix. map st :{{ set sortby time - set showinfo time + set info time }} diff --git a/etc/lfrc.example b/etc/lfrc.example index 288d045..d5e4c5c 100644 --- a/etc/lfrc.example +++ b/etc/lfrc.example @@ -3,7 +3,7 @@ # (e.g. "alias mc='tmux split -h lf; lf'"). #set ratios 1 #set nopreview -#set showinfo size +#set info size # interpreter for shell commands (needs to be POSIX compatible) #set shell /bin/sh @@ -21,15 +21,15 @@ map zp set preview! map zh set hidden! # easily select what information to show -map zn set showinfo -map zs set showinfo size -map zt set showinfo time -map za set showinfo size:time +map zn set info +map zs set info size +map zt set info time +map za set info size:time # sort files and show the corresponding info -map sn :set sortby name; set showinfo -map ss :set sortby size; set showinfo size -map st :set sortby time; set showinfo time +map sn :set sortby name; set info +map ss :set sortby size; set info size +map st :set sortby time; set info time # common directories map gh cd ~ diff --git a/eval.go b/eval.go index 0defbcb..6a9614e 100644 --- a/eval.go +++ b/eval.go @@ -113,17 +113,17 @@ func (e *setExpr) eval(app *app, args []string) { gOpts.ratios = rats app.ui.wins = getWins() app.ui.loadFile(app.nav) - case "showinfo": + case "info": toks := strings.Split(e.val, ":") for _, s := range toks { if s != "" && s != "size" && s != "time" { - msg := "showinfo should consist of 'size' or 'time' separated with colon" + msg := "info should consist of 'size' or 'time' separated with colon" app.ui.message = msg log.Print(msg) return } } - gOpts.showinfo = toks + gOpts.info = toks default: msg := fmt.Sprintf("unknown option: %s", e.opt) app.ui.message = msg diff --git a/eval_test.go b/eval_test.go index 3392c41..2baf017 100644 --- a/eval_test.go +++ b/eval_test.go @@ -228,15 +228,15 @@ var gEvalTests = []struct { }, { - "map ss :set sortby size; set showinfo size", - []string{"map", "ss", ":", "set", "sortby", "size", ";", "set", "showinfo", "size", "\n", "\n"}, - []expr{&mapExpr{"ss", &listExpr{[]expr{&setExpr{"sortby", "size"}, &setExpr{"showinfo", "size"}}}}}, + "map ss :set sortby size; set info size", + []string{"map", "ss", ":", "set", "sortby", "size", ";", "set", "info", "size", "\n", "\n"}, + []expr{&mapExpr{"ss", &listExpr{[]expr{&setExpr{"sortby", "size"}, &setExpr{"info", "size"}}}}}, }, { - "map ss :set sortby size; set showinfo size;", - []string{"map", "ss", ":", "set", "sortby", "size", ";", "set", "showinfo", "size", ";", "\n"}, - []expr{&mapExpr{"ss", &listExpr{[]expr{&setExpr{"sortby", "size"}, &setExpr{"showinfo", "size"}}}}}, + "map ss :set sortby size; set info size;", + []string{"map", "ss", ":", "set", "sortby", "size", ";", "set", "info", "size", ";", "\n"}, + []expr{&mapExpr{"ss", &listExpr{[]expr{&setExpr{"sortby", "size"}, &setExpr{"info", "size"}}}}}, }, { diff --git a/opts.go b/opts.go index a7f8805..6de6274 100644 --- a/opts.go +++ b/opts.go @@ -16,7 +16,7 @@ var gOpts struct { sortby string timefmt string ratios []int - showinfo []string + info []string keys map[string]expr cmds map[string]expr } @@ -33,7 +33,7 @@ func init() { gOpts.sortby = "natural" gOpts.timefmt = time.ANSIC gOpts.ratios = []int{1, 2, 3} - gOpts.showinfo = nil + gOpts.info = nil gOpts.keys = make(map[string]expr) diff --git a/ui.go b/ui.go index 5c7750b..8ed295a 100644 --- a/ui.go +++ b/ui.go @@ -288,14 +288,14 @@ func (win *win) printd(dir *dir, marks map[string]int, saves map[string]bool) { var info string - for _, s := range gOpts.showinfo { + for _, s := range gOpts.info { switch s { case "size": info = fmt.Sprintf("%s %4s", info, humanize(f.Size())) case "time": info = fmt.Sprintf("%s %12s", info, f.ModTime().Format("Jan _2 15:04")) default: - log.Printf("unknown showinfo type: %s", s) + log.Printf("unknown info type: %s", s) } }