From 7588d84b62bf3f9e3c85d6e7001a41ec409cf733 Mon Sep 17 00:00:00 2001 From: harveyshao Date: Mon, 29 Nov 2021 10:07:32 +0800 Subject: [PATCH] opt some --- base/web/serve.go | 2 +- core/code/python.go | 47 +++++++++++++++------------------------------ 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/base/web/serve.go b/base/web/serve.go index 27c96ab2..ebf82a54 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -257,7 +257,7 @@ func init() { LOGIN, ice.TRUE, SHARE, ice.TRUE, SPACE, ice.TRUE, ice.VOLCANOS, ice.TRUE, ice.PUBLISH, ice.TRUE, ice.INTSHELL, ice.TRUE, ice.REQUIRE, ice.TRUE, - "x", ice.TRUE, + "help", ice.TRUE, "x", ice.TRUE, ), LOGHEADERS, ice.FALSE, kit.MDB_PATH, kit.Dict("/", ice.USR_VOLCANOS), diff --git a/core/code/python.go b/core/code/python.go index e725ab89..d55ce919 100644 --- a/core/code/python.go +++ b/core/code/python.go @@ -1,44 +1,29 @@ package code import ( - "path" - ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/cli" - "shylinux.com/x/icebergs/base/web" kit "shylinux.com/x/toolkits" ) const PYTHON = "python" func init() { - Index.Merge(&ice.Context{ - Configs: map[string]*ice.Config{ - PYTHON: {Name: PYTHON, Help: "脚本命令", Value: kit.Data( - cli.SOURCE, "http://mirrors.sohu.com/python/3.5.2/Python-3.5.2.tar.xz", - PYTHON, "python", - )}, - }, - Commands: map[string]*ice.Command{ - PYTHON: {Name: "python port path auto start build download", Help: "脚本命令", Action: map[string]*ice.Action{ - web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) { - m.Cmdy(INSTALL, web.DOWNLOAD, m.Conf(PYTHON, kit.Keym(cli.SOURCE))) - }}, - cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) { - m.Cmdy(INSTALL, cli.BUILD, m.Conf(PYTHON, kit.Keym(cli.SOURCE))) - }}, - cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) { - m.Cmdy(INSTALL, cli.START, m.Conf(PYTHON, kit.Keym(cli.SOURCE)), "bin/python3") - }}, - ice.RUN: {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) { - m.Cmdy(cli.SYSTEM, m.Conf(PYTHON, kit.Keym(PYTHON)), arg) - }}, - "pip": {Name: "pip", Help: "安装", Hand: func(m *ice.Message, arg ...string) { - m.Cmdy(cli.SYSTEM, m.Conf(PYTHON, kit.Keym("pip")), "install", arg) - }}, - }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Cmdy(INSTALL, path.Base(m.Conf(PYTHON, kit.META_SOURCE)), arg) + Index.Merge(&ice.Context{Configs: map[string]*ice.Config{ + PYTHON: {Name: PYTHON, Help: "脚本命令", Value: kit.Data( + cli.SOURCE, "http://mirrors.sohu.com/python/3.5.2/Python-3.5.2.tar.xz", + PYTHON, "python", "pip", "pip", + )}, + }, Commands: map[string]*ice.Command{ + PYTHON: {Name: "python path auto order build download", Help: "脚本命令", Action: ice.MergeAction(map[string]*ice.Action{ + ice.RUN: {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) { + m.Cmdy(cli.SYSTEM, m.Config(PYTHON), arg) }}, - }, - }) + "pip": {Name: "pip", Help: "安装", Hand: func(m *ice.Message, arg ...string) { + m.Cmdy(cli.SYSTEM, m.Config("pip"), "install", arg) + }}, + }, InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + m.Cmdy(INSTALL, cli.SOURCE, m.Config(cli.SOURCE), arg) + }}, + }}) }