From 94cfb309d7e98ee43888702ac121aebf1dbd82c8 Mon Sep 17 00:00:00 2001 From: shaoying Date: Wed, 30 Oct 2019 13:30:40 +0800 Subject: [PATCH] opt etc --- Makefile | 94 +++++----------------------- etc/conf/.gitconfig | 24 +++++++ etc/{dotsfile => conf}/.tmux.conf | 0 etc/{dotsfile => conf}/.vimrc | 0 etc/{dotsfile => conf}/.zshrc | 0 etc/{dotsfile => conf}/go.vim | 0 etc/{dotsfile => conf}/javasript.vim | 0 etc/{dotsfile => conf}/shy.vim | 0 etc/dotsfile/cVim | 22 ------- etc/dotsfile/git_hooks/post-commit | 1 - src/contexts/cli/version.go | 2 +- src/contexts/ctx/ctx.go | 17 +++-- src/contexts/nfs/nfs.go | 20 +++--- 13 files changed, 61 insertions(+), 119 deletions(-) create mode 100644 etc/conf/.gitconfig rename etc/{dotsfile => conf}/.tmux.conf (100%) rename etc/{dotsfile => conf}/.vimrc (100%) rename etc/{dotsfile => conf}/.zshrc (100%) rename etc/{dotsfile => conf}/go.vim (100%) rename etc/{dotsfile => conf}/javasript.vim (100%) rename etc/{dotsfile => conf}/shy.vim (100%) delete mode 100644 etc/dotsfile/cVim delete mode 100755 etc/dotsfile/git_hooks/post-commit diff --git a/Makefile b/Makefile index 7e4897e6..41f8e8c5 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,13 @@ +PUBLISH=usr/publish BENCH=src/extend/bench.go -publish=usr/publish/ +BUILD=go build -o $(PUBLISH)/ -install: +install:prepare + GOPATH=$(PWD):$(GOPATH) go install $(BENCH) && date && echo + @bin/boot.sh restart && date + +prepare: @go get github.com/nsf/termbox-go @go get github.com/gorilla/websocket @go get github.com/go-sql-driver/mysql @@ -10,88 +15,17 @@ install: @go get github.com/gomarkdown/markdown @go get github.com/skip2/go-qrcode @go get gopkg.in/gomail.v2 - GOPATH=$(PWD):$(GOPATH) go install $(BENCH) - @date - -install_all: install - touch etc/init.shy - touch etc/exit.shy - touch etc/local.shy - touch etc/local_exit.shy - -run: - etc/bootstrap.sh -shy: - cp -r src/toolkit ~/context/src/ - cp -r src/contexts ~/context/src/ - cp -r src/examples ~/context/src/ - cp -r usr/template ~/context/usr/ - cp -r usr/librarys/ ~/context/usr/ - cp -r bin ~/context - -tar: - [ -e tar ] || mkdir tar - [ -e tar/bin ] || mkdir tar/bin - [ -e tar/etc ] || mkdir tar/etc - cp etc/bootstrap.sh tar/ - cp etc/init.shy tar/etc/ - cp etc/exit.shy tar/etc/ - touch tar/etc/local.shy - touch tar/etc/exit_local.shy - [ -e tar/usr ] || mkdir tar/usr - cp -r usr/template tar/usr - cp -r usr/librarys tar/usr - [ -e tar/var ] || mkdir tar/var - -tar_all: tar linux64 darwin win64 - cp etc/local.shy tar/etc/ - cp etc/exit_local.shy tar/etc/ - mv bench.darwin tar/bin/ - mv bench.linux64 tar/bin/ - mv bench.win64.exe tar/bin/ - tar zcvf tar.tgz tar linux_arm: - GOARCH=arm GOOS=linux go build -o $(publish)bench.linux.arm $(BENCH) + GOARCH=arm GOOS=linux $(BUILD)bench.linux.arm $(BENCH) linux32: - GOARCH=386 GOOS=linux go build -o $(publish)bench.linux.386 $(BENCH) + GOARCH=386 GOOS=linux $(BUILD)bench.linux.386 $(BENCH) linux64: - GOARCH=amd64 GOOS=linux go build -o $(publish)bench.linux.amd64 $(BENCH) + GOARCH=amd64 GOOS=linux $(BUILD)bench.linux.amd64 $(BENCH) darwin: - GOARCH=amd64 GOOS=darwin go build -o $(publish)bench.darwin.amd64 $(BENCH) -win32: - GOARCH=386 GOOS=windows go build -o $(publish)bench.win32.exe $(BENCH) + GOARCH=amd64 GOOS=darwin $(BUILD)bench.darwin.amd64 $(BENCH) win64: - GOARCH=amd64 GOOS=windows go build -o $(publish)bench.win64.exe $(BENCH) - - -DOTS=etc/dotsfile -back_dotsfile: - cp ~/.zshrc $(DOTS) - cp ~/.tmux.conf $(DOTS) - cp ~/.vimrc $(DOTS) - cp ~/.vim/syntax/go.vim $(DOTS) - cp ~/.vim/syntax/shy.vim $(DOTS) - -load_dotsfile:\ - ~/.zshrc\ - ~/.tmux.conf\ - ~/.vimrc\ - ~/.vim/syntax/go.vim\ - ~/.vim/syntax/shy.vim - -~/.zshrc: $(DOTS)/.zshrc - cp $< $@ -~/.tmux.conf: $(DOTS)/.tmux.conf - cp $< $@ -~/context/.git/hooks/post-commit: $(DOTS)/git_hooks/post-commit - cp $< $@ -~/.vimrc: $(DOTS)/.vimrc - cp $< $@ -~/.vim/syntax/go.vim: $(DOTS)/go.vim - cp $< $@ -~/.vim/syntax/shy.vim: $(DOTS)/shy.vim - cp $< $@ - -.PHONY: tar run + GOARCH=amd64 GOOS=windows $(BUILD)bench.win64.exe $(BENCH) +win32: + GOARCH=386 GOOS=windows $(BUILD)bench.win32.exe $(BENCH) diff --git a/etc/conf/.gitconfig b/etc/conf/.gitconfig new file mode 100644 index 00000000..daa483b8 --- /dev/null +++ b/etc/conf/.gitconfig @@ -0,0 +1,24 @@ +[user] + name = shaoying + email = shylinux@icloud.com +[color] + ui = always +[alias] + s = status + l = log --pretty=format:\"%C(4)%h %C(6)%ad %C(4)%an %C(6)%ar %C(4)%d %n%C(7)%s\" --date=\"format:%m/%d %R\" --shortstat --graph + b = branch + r = remote + m = merge + t = tag + i = commit + o = checkout + d = diff + a = add + am = commit -a -m +[receive] + denyCurrentBranch = ignore +[core] + editor = vim + ignorecase = true +[merge] + tool = vimdiff diff --git a/etc/dotsfile/.tmux.conf b/etc/conf/.tmux.conf similarity index 100% rename from etc/dotsfile/.tmux.conf rename to etc/conf/.tmux.conf diff --git a/etc/dotsfile/.vimrc b/etc/conf/.vimrc similarity index 100% rename from etc/dotsfile/.vimrc rename to etc/conf/.vimrc diff --git a/etc/dotsfile/.zshrc b/etc/conf/.zshrc similarity index 100% rename from etc/dotsfile/.zshrc rename to etc/conf/.zshrc diff --git a/etc/dotsfile/go.vim b/etc/conf/go.vim similarity index 100% rename from etc/dotsfile/go.vim rename to etc/conf/go.vim diff --git a/etc/dotsfile/javasript.vim b/etc/conf/javasript.vim similarity index 100% rename from etc/dotsfile/javasript.vim rename to etc/conf/javasript.vim diff --git a/etc/dotsfile/shy.vim b/etc/conf/shy.vim similarity index 100% rename from etc/dotsfile/shy.vim rename to etc/conf/shy.vim diff --git a/etc/dotsfile/cVim b/etc/dotsfile/cVim deleted file mode 100644 index a22693e8..00000000 --- a/etc/dotsfile/cVim +++ /dev/null @@ -1,22 +0,0 @@ -set showtabindices -imap deleteChar -imap deleteForwardChar -imap deleteWord -imap beginningOfLine -imap deleteToEnd -map w :tabnew -map m :tabnew -map t goToTab -map q goToTab -map p goToTab -map v nextTab -map c previousTab -map nextTab -map previousTab -map goBack -map goForward -map createTabbedHint -map s scrollPageUp -map a :history -map e :tabnew -let blacklists = ["https://shylinux.com/*"] diff --git a/etc/dotsfile/git_hooks/post-commit b/etc/dotsfile/git_hooks/post-commit deleted file mode 100755 index f1f641af..00000000 --- a/etc/dotsfile/git_hooks/post-commit +++ /dev/null @@ -1 +0,0 @@ -#!/usr/bin/env bash diff --git a/src/contexts/cli/version.go b/src/contexts/cli/version.go index ee465f2d..e7abebb9 100644 --- a/src/contexts/cli/version.go +++ b/src/contexts/cli/version.go @@ -7,5 +7,5 @@ var version = struct { self int }{ []string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"}, - `2019-10-29 15:36:42`, `centos`, 653, + `2019-10-30 12:50:03`, `mac`, 667, } diff --git a/src/contexts/ctx/ctx.go b/src/contexts/ctx/ctx.go index 1c7abda1..7c79e8b7 100644 --- a/src/contexts/ctx/ctx.go +++ b/src/contexts/ctx/ctx.go @@ -86,6 +86,15 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{}, "nmessage": &Cache{Name: "nmessage", Value: "1", Help: "消息数量"}, }, Configs: map[string]*Config{ + "help": &Config{Name: "help", Value: map[string]interface{}{ + "index": []interface{}{ + "^_^ Welcome to Context world ^_^", + "V2.1: Miss You Forever", + "Date: 2019.10.29 13:14:21", + "More: https://shylinux.com", + "More: https://github.com/shylinux/context", + }, + }, Help: "帮助"}, "time": &Config{Name: "timer", Value: map[string]interface{}{ "unit": 1000, "close": "open", "format": "2006-01-02 15:04:05", }, Help: "时间参数"}, @@ -111,11 +120,9 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{}, "help": &Command{Name: "help topic", Help: "帮助", Hand: func(m *Message, c *Context, key string, arg ...string) (e error) { if len(arg) == 0 { - m.Echo("^_^ Welcome to context world ^_^\n") - m.Echo("V2.1: Miss You Forever\n") - m.Echo("Date: 2019.10.29 13:14:21\n") - m.Echo("More: https://github.com/shylinux/context\n") - m.Echo("More: https://shylinux.com/\n") + m.Confm("help", "index", func(index int, value string) { + m.Echo(value).Echo("\n") + }) return } diff --git a/src/contexts/nfs/nfs.go b/src/contexts/nfs/nfs.go index a0164ca6..da0705a4 100644 --- a/src/contexts/nfs/nfs.go +++ b/src/contexts/nfs/nfs.go @@ -713,16 +713,16 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心", return false }) - if !find && arg[0] != "" { - if strings.HasSuffix(arg[0], "/") { - m.Assert(os.MkdirAll(arg[0], 0777)) - m.Echo(arg[0]) - } else if f, p, e := kit.Create(arg[0]); m.Assert(e) { - f.Close() - m.Echo(p) - } - } - + // if !find && arg[0] != "" { + // if strings.HasSuffix(arg[0], "/") { + // m.Assert(os.MkdirAll(arg[0], 0777)) + // m.Echo(arg[0]) + // } else if f, p, e := kit.Create(arg[0]); m.Assert(e) { + // f.Close() + // m.Echo(p) + // } + // } + // if m.Has("dir_sort") { m.Sort(m.Meta["dir_sort"][0], m.Meta["dir_sort"][1:]...) }