NodeScriptKit

快速使用

bash <(curl -sL https://sh.nodeseek.com)

Github项目,欢迎star,fork,pr

自由的配置格式

程序通过toml格式的配置文件生成菜单,用户只要安装正确格式的配置文件填写,即可实现自己的命令小抄
程序还支持订阅远程连接,用户可以把常见的配置放到GitHub上,利用raw链接加载,也可以分享给他人使用

[local]
include = [
    '/etc/nsk/modules.d/default/*.toml',
    '/etc/nsk/modules.d/extend/*.toml',
]

[remote]
subscribes = [
    # remote urls
]

配置文件支持模块化加载,会自动加载(并拼接)多个模块(对象合并而非文本合并)。

详细的模块配置文件说明可以参考GitHub项目,这里仅简单举例说明

[scripts]
# 脚本集合,键值对
memory = "free -h"
disk = "df -hT"
cpuinfo = "cat /proc/cpuinfo"
whoami = "whoami"

hello = "echo \"hello world\""
yabs = "curl -sL yabs.sh | bash"
docker = "bash <(curl -sL 'https://get.docker.com')"

test = "echo '这是一个测试项'"
[[menus]]
id = "main"
title = "主菜单"
sub_menus = [
    "info",
    "tool",
    "test"
]

[[menus]]
id = "info"
title = "系统信息"
sub_menus = [
    "cpu",
    "memory",
    "disk",
    "current-user",
]

[[menus]]
id = "test"
title = "测试项"
script = "test"

如上面所示,main菜单是入口菜单,有3个子菜单,其中info子菜单有进一步的子菜单,而test菜单没有下级,直接指向id为test的脚本

这些菜单id负责穿针引线,落叶归根到脚本id

Comments

No comments yet. Why don’t you start the discussion?

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注