From 76cd7bf6c075b88e629d35b977141752b3eb08b8 Mon Sep 17 00:00:00 2001 From: shaoying Date: Mon, 20 Aug 2018 21:54:14 +0800 Subject: [PATCH] tce mod nfs.history --- Makefile | 5 +++++ etc/init.shy | 1 + src/contexts/nfs/nfs.go | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 45f79a31..e93c9eff 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,11 @@ install: @cp etc/go.snippets ~/.vim/snippets/ @cp etc/shy.vim ~/.vim/syntax/ @touch etc/local.shy + @touch etc/local_exit.shy + @touch etc/init.shy + @touch etc/exit.shy + @touch etc/login.txt + @touch etc/history.txt go install $(BENCH) # @[ `uname` = "Darwin" ] && md5 `which bench` @date diff --git a/etc/init.shy b/etc/init.shy index 7277f5b8..3844103a 100644 --- a/etc/init.shy +++ b/etc/init.shy @@ -10,3 +10,4 @@ source etc/local.shy alias import nfs alias send send alias dial dial + diff --git a/src/contexts/nfs/nfs.go b/src/contexts/nfs/nfs.go index 1c7234ec..8be93ea3 100644 --- a/src/contexts/nfs/nfs.go +++ b/src/contexts/nfs/nfs.go @@ -856,9 +856,9 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心", "git_log": &ctx.Config{Name: "git_log", Value: "--pretty=%h %an(%ad) %s --date=format:%m/%d %H:%M --graph", Help: "版本控制状态参数"}, "git_log_form": &ctx.Config{Name: "git_log", Value: "stat", Help: "版本控制状态参数"}, "git_log_skip": &ctx.Config{Name: "git_log", Value: "0", Help: "版本控制状态参数"}, - "git_log_line": &ctx.Config{Name: "git_log", Value: "5", Help: "版本控制状态参数"}, + "git_log_line": &ctx.Config{Name: "git_log", Value: "3", Help: "版本控制状态参数"}, "git_path": &ctx.Config{Name: "git_path", Value: ".", Help: "版本控制默认路径"}, - "git_info": &ctx.Config{Name: "git_info", Value: "branch status diff", Help: "命令集合"}, + "git_info": &ctx.Config{Name: "git_info", Value: "branch status diff log", Help: "命令集合"}, }, Commands: map[string]*ctx.Command{ "paths": &ctx.Command{ @@ -949,11 +949,20 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心", if lines != -1 && (i-pos) >= lines { break } - nfs.history = append(nfs.history, bio.Text()) + line := bio.Text() + for _, v := range nfs.history { + if line == v { + line = "" + } + } + if line != "" { + nfs.history = append(nfs.history, line) + } } m.Capi("nline", 0, len(nfs.history)) case "save": f, e := os.Create(arg[1]) + // f, e := os.OpenFile(arg[1], os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) m.Assert(e) defer f.Close()