From f98cf8c11386af9ba3d2de8d64ce1ad43093a2a1 Mon Sep 17 00:00:00 2001 From: harveyshao Date: Sat, 21 May 2022 14:38:27 +0800 Subject: [PATCH] opt some --- core/chat/website.go | 6 ++++++ core/code/sh.go | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/chat/website.go b/core/chat/website.go index 68087ddd..398835f0 100644 --- a/core/chat/website.go +++ b/core/chat/website.go @@ -56,9 +56,15 @@ func _website_parse(m *ice.Message, text string, args ...string) (map[string]int case nfs.GO: ls[0] = ice.GetFileCmd(ls[0]) + case nfs.SH: + ls[0], data[ctx.ARGS] = "web.code.sh.sh", ls[0] + case nfs.SHY: ls[0], data[ctx.ARGS] = "web.wiki.word", ls[0] + case nfs.PY: + ls[0], data[ctx.ARGS] = "web.code.sh.py", ls[0] + case "~": prefix = ls[1] ls = ls[1:] diff --git a/core/code/sh.go b/core/code/sh.go index 184e992e..bc7df135 100644 --- a/core/code/sh.go +++ b/core/code/sh.go @@ -13,11 +13,20 @@ import ( func _sh_main_script(m *ice.Message, arg ...string) (res []string) { if cmd := ice.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" { res = append(res, kit.Format(`#! /bin/sh -export ctx_dev=%s; ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp %s &>/dev/null +export ctx_dev=%s; ctx_pod=%s ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp &>/dev/null +_done="" _list() { - ish_sys_dev_run_command "$@" + if [ "$_done" = "" ]; then + ish_sys_dev_run %s "$@" + else + ish_sys_dev_run_command "$@" + fi + _done=done } -`, "http://localhost:9020", cmd)) +_action() { + _list action "$@" +} +`, "http://localhost:9020", m.Option(ice.MSG_USERPOD), cmd)) } if kit.FileExists(kit.Path(arg[2], arg[1])) {