1
0
forked from x/ContextOS
This commit is contained in:
shaoying 2019-10-30 13:30:40 +08:00
parent 79c289c3f8
commit 94cfb309d7
13 changed files with 61 additions and 119 deletions

View File

@ -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)

24
etc/conf/.gitconfig Normal file
View File

@ -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

View File

@ -1,22 +0,0 @@
set showtabindices
imap <C-h> deleteChar
imap <C-d> deleteForwardChar
imap <C-w> deleteWord
imap <C-a> beginningOfLine
imap <C-k> deleteToEnd
map w :tabnew
map m :tabnew
map t goToTab
map q goToTab
map p goToTab
map v nextTab
map c previousTab
map <C-j> nextTab
map <C-k> previousTab
map <C-o> goBack
map <C-i> goForward
map <C-f> createTabbedHint
map s scrollPageUp
map a :history
map e :tabnew
let blacklists = ["https://shylinux.com/*"]

View File

@ -1 +0,0 @@
#!/usr/bin/env bash

View File

@ -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,
}

View File

@ -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
}

View File

@ -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:]...)
}