1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-26 01:04:06 +08:00
This commit is contained in:
shaoying 2019-11-12 20:37:31 +08:00
parent ae04d14640
commit bddad6839c
4 changed files with 14 additions and 9 deletions

View File

@ -10,7 +10,7 @@ ctx_sync=${ctx_sync:=""}
ctx_sid=${ctx_sid:=""} ctx_sid=${ctx_sid:=""}
ctx_welcome=${ctx_welcome:="^_^ Welcome to Context world ^_^"} ctx_welcome=${ctx_welcome:="^_^ Welcome to Context world ^_^"}
ctx_goodbye=${ctx_goodbye:="^_^ Welcome to Context world ^_^"} ctx_goodbye=${ctx_goodbye:="^_^ Goodbye to Context world ^_^"}
ShyWord() { ShyWord() {
echo "$*"|sed -e 's/\ /%20/g' -e 's/\n/\\n/g' echo "$*"|sed -e 's/\ /%20/g' -e 's/\n/\\n/g'
@ -139,17 +139,19 @@ ShyLogin() {
echo "url: ${ctx_url}" echo "url: ${ctx_url}"
echo "sid: ${ctx_sid:0:6}" echo "sid: ${ctx_sid:0:6}"
echo "pid: $$" echo "pid: $$"
echo "pane: $TMUX_PANE"
echo "begin: ${ctx_begin}" echo "begin: ${ctx_begin}"
} }
ShyInit() { ShyInit() {
ctx_begin=`cat $HISTFILE|wc -l`
case "$SHELL" in case "$SHELL" in
"/bin/zsh");; "/bin/zsh");;
*) *)
ctx_begin=`history|tail -n1|awk '{print $1}'` ctx_begin=`history|tail -n1|awk '{print $1}'`
bind -x '"\C-t":ShySyncs base' bind -x '"\C-t":ShySyncs base'
# bind -x '"\C-gl":ShySync input' # bind -x '"\C-gl":ShySync input'
# PS1="\!-\t[\u@\h]\W\$ " PS1="\!-\t[\u@\h]\W\$ "
PS1="\!-\t\$ " # PS1="\!-\t\$ "
;; ;;
esac esac
} }

View File

@ -17,8 +17,8 @@ set -g set-titles on
set -g set-titles-string "#(whoami)@#h/#{session_name}:#{window_name}.#{pane_index} #{pane_current_command}" set -g set-titles-string "#(whoami)@#h/#{session_name}:#{window_name}.#{pane_index} #{pane_current_command}"
set -g status-interval 1 set -g status-interval 1
set -g status-left-length 200 set -g status-left-length 60
set -g status-right-length 200 set -g status-right-length 60
# set -g status-left "#[bg=red]\ [#H/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ " # set -g status-left "#[bg=red]\ [#H/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ "
set -g status-left "#[bg=red]\ [#h/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ " set -g status-left "#[bg=red]\ [#h/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ "
set -g status-right "#[bg=yellow]\ [#(date '+%Y-%m-%d %H:%M:%S')]\ #[bg=red]\ [#{pane_current_path}]\ " set -g status-right "#[bg=yellow]\ [#(date '+%Y-%m-%d %H:%M:%S')]\ #[bg=red]\ [#{pane_current_path}]\ "

View File

@ -601,7 +601,7 @@ func (m *Message) Grows(key string, args interface{}, cb interface{}) map[string
begin := end - limit begin := end - limit
data := make([]interface{}, 0, limit) data := make([]interface{}, 0, limit)
m.Log("info", "read current %v+%d %v-%v", current, len(list), begin, end) m.Log("info", "read %v-%v from %v-%v", begin, end, current, current+len(list))
if begin < current { if begin < current {
store, _ := meta["record"].([]interface{}) store, _ := meta["record"].([]interface{})
for s := len(store) - 1; s > -1; s-- { for s := len(store) - 1; s > -1; s-- {
@ -660,8 +660,8 @@ func (m *Message) Grows(key string, args interface{}, cb interface{}) map[string
if begin < current { if begin < current {
begin = current begin = current
} }
m.Log("info", "cache %v-%v", begin-current, end-current)
for i := begin - current; i < end-current; i++ { for i := begin - current; i < end-current; i++ {
m.Log("info", "cache data %v %v", i+current, list[i])
data = append(data, list[i]) data = append(data, list[i])
} }
return kit.Map(map[string]interface{}{"meta": meta, "list": data}, "", cb) return kit.Map(map[string]interface{}{"meta": meta, "list": data}, "", cb)

View File

@ -290,6 +290,9 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
m.Push(fields, kit.Shortm(value, "times", "files", "sids")) m.Push(fields, kit.Shortm(value, "times", "files", "sids"))
} }
}) })
if arg[0] == "df" {
m.Sort("size", "int_r")
}
m.Table() m.Table()
case "free": case "free":
if len(arg) > 3 { if len(arg) > 3 {
@ -753,11 +756,11 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
} }
fallthrough fallthrough
case "editor": case "editor":
if arg[2] != "" { if len(arg) > 2 && arg[2] != "" {
m.Conf(cmd, []string{arg[0], "hash", arg[1], "table"}, arg[2]) m.Conf(cmd, []string{arg[0], "hash", arg[1], "table"}, arg[2])
m.Conf(cmd, []string{arg[0], "hash", arg[1], "river"}, m.Option("river")) m.Conf(cmd, []string{arg[0], "hash", arg[1], "river"}, m.Option("river"))
} }
if arg[1] != "" { if len(arg) > 1 && arg[1] != "" {
m.Option("table.format", "table") m.Option("table.format", "table")
m.Confm(cmd, []string{arg[0], "hash", arg[1]}, func(key string, value string) { m.Confm(cmd, []string{arg[0], "hash", arg[1]}, func(key string, value string) {
m.Push(key, value) m.Push(key, value)