Update documentation
parent
be34e758d0
commit
1c046cc92c
|
@ -50,7 +50,7 @@
|
|||
|
||||
**verify \<Provider> ...**
|
||||
|
||||
Verify program provider info.
|
||||
Verify program provider info.
|
||||
|
||||
**add \<Provider> ...**
|
||||
|
||||
|
@ -90,7 +90,7 @@ All scripts in official OpenComputerScript repository are under MIT license.
|
|||
|
||||
Before downloading any package under other licenses, Grab will ask you to agree with it.
|
||||
|
||||
This confirmation can be skipped by calling Grab with --accept-license.
|
||||
This confirmation can be skipped by calling Grab with `--accept-license`.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -106,6 +106,7 @@ If a license is both accepted and refused, it will be refused.
|
|||
A package is considered to be official only if it does not specified repo and proxy. Official packages usually only depend on official packages.
|
||||
|
||||
You can also install packages from unofficial program provider with Grab, but Grab will not check its security.
|
||||
|
||||
Notice that override of official packages is not allowed.
|
||||
|
||||
#### Router and Proxy
|
||||
|
@ -115,7 +116,7 @@ Notice that override of official packages is not allowed.
|
|||
A route function takes repo, branch and file address as arguments, and returns a resolved url.
|
||||
It can be used to boost downloading by redirecting requests to mirror site.
|
||||
|
||||
As router functions can be used to redirect requests, Grab will give an warning if --router option presents.
|
||||
As router functions can be used to redirect requests, Grab will give an warning if `--router` option presents.
|
||||
|
||||
proxy_func(Url : string): boolean, string
|
||||
|
||||
|
@ -129,6 +130,8 @@ If the first value is false, the downloading is failed. The second value will th
|
|||
|
||||
If proxy functions throw an error, Grab will try the default downloader.
|
||||
|
||||
As proxy functions can handle low-level network operations, Grab will give an warning if `--proxy` option presents.
|
||||
|
||||
## Explaination of programs list
|
||||
|
||||
An official programs list is maintained as [programs.info](programs.info). You can keep your local programs list up to date by running `grab update`.
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
# Grab文档
|
||||
|
||||
## Grab - 官方脚本安装器
|
||||
|
||||
### 用法
|
||||
|
||||
grab [<选项>] <命令> ...
|
||||
|
||||
### 选项
|
||||
|
||||
*--cn*
|
||||
|
||||
使用国内镜像进行下载. 若不指定此选项则默认从Github下载. 此选项可能只对(本仓库内的)官方包管用.
|
||||
|
||||
*--help*
|
||||
|
||||
显示帮助信息. (使用OpenOS提供的less程序)
|
||||
|
||||
*--version*
|
||||
|
||||
显示版本号.
|
||||
|
||||
*--router=\<路由文件>*
|
||||
|
||||
加载一个文件,这个文件应返回如下类型的函数:
|
||||
function(仓库名称: string, 分支名称: string ,文件位置: string): string
|
||||
|
||||
*--proxy=\<代理文件>*
|
||||
|
||||
加载一个文件,这个文件应返回如下类型的函数:
|
||||
function(网址 : string): boolean, string
|
||||
|
||||
*--skip-install*
|
||||
|
||||
指定此选项时, 包的安装脚本不会被调用. (仅下载)
|
||||
|
||||
*--refuse-license=\<协议>*
|
||||
|
||||
通过此选项指定拒绝的协议. 用英文逗号分隔多个协议名称.
|
||||
|
||||
*--accept-license=\<协议> *
|
||||
|
||||
通过此选项指定接受的协议. 用英文逗号分隔多个协议名称.
|
||||
|
||||
### 命令
|
||||
|
||||
**install \<包名> ...**
|
||||
|
||||
安装对应的包. 依赖库会被自动下载.
|
||||
|
||||
**verify \<程序列表> ...**
|
||||
|
||||
验证程序列表的合法性.
|
||||
|
||||
**add \<程序列表> ...**
|
||||
|
||||
将程序列表添加到Grab, 使得对应的包能通过grab install安装.
|
||||
|
||||
**update**
|
||||
|
||||
更新程序列表.
|
||||
|
||||
**clear**
|
||||
|
||||
清除程序列表.
|
||||
|
||||
**list**
|
||||
|
||||
列出程序列表中全部的包.
|
||||
|
||||
**search \<包名 或 Lua正则表达式>**
|
||||
|
||||
通过包名进行搜索.
|
||||
|
||||
**show \<包名>**
|
||||
|
||||
列出对应包的详细信息.
|
||||
|
||||
**download \<文件名> ...**
|
||||
|
||||
直接下载文件. (不推荐)
|
||||
|
||||
### 注意事项
|
||||
|
||||
#### 协议
|
||||
|
||||
下载和使用Grab表明您已同意 [MIT协议](https://github.com/Kiritow/OpenComputerScripts/blob/master/LICENSE).
|
||||
|
||||
官方仓库中的全部脚本都基于MIT协议.
|
||||
|
||||
在下载任何其他指定了协议的包之前, Grab会要求您同意对应的协议.
|
||||
|
||||
这个确认过程可以通过指定`--accept-license`选项来跳过.
|
||||
|
||||
例如:
|
||||
|
||||
--accept-license=mit 表明您接受MIT协议.
|
||||
--refuse-license=mit 表明您拒绝MIT协议.
|
||||
--accept-license 表明您接受任何协议.
|
||||
--refuse-license 表明您拒绝任何协议.(此选项不会影响官方库的使用)
|
||||
|
||||
如果一个协议即被接受又被拒绝, 该协议将被拒绝.
|
||||
|
||||
#### 程序提供方
|
||||
|
||||
仅在一个包没有指定库和代理URL的时候才会被认为是官方包. 通常, 官方包仅会依赖官方包.
|
||||
|
||||
你可以使用Grab来安装非官方的包, 但Grab不会检查其安全性.
|
||||
|
||||
请注意, 通过Grab添加的程序列表不能覆盖官方包信息.
|
||||
|
||||
#### 路由和代理
|
||||
|
||||
route_func(仓库名称: string, 分支名称: string ,文件位置: string): string
|
||||
|
||||
路由函数传入仓库名称、分支名称和文件位置, 传出一个网址. 例如, 通过重定向请求到镜像站可以加快下载速度.
|
||||
|
||||
由于路由函数可以重定向请求, 当使用`--router`选项时, Grab会给出一条警告信息.
|
||||
|
||||
proxy_func(网址 : string): boolean, string
|
||||
|
||||
代理函数传入网址,至少返回两个值.
|
||||
|
||||
代理函数可处理不同协议的请求或底层网络操作. 例如通过socks5代理或游戏内网络下载数据.
|
||||
|
||||
若第一个返回值是true, 则下载成功, 此时第二个返回值是下载得到的数据.
|
||||
|
||||
若第一个返回值是false, 则下载失败, 此时第二个返回值是错误消息.
|
||||
|
||||
如果代理函数抛出异常, Grab会尝试使用默认下载器. (这样对某些不需要代理的网址就可以使用默认下载器)
|
||||
|
||||
由于代理函数可以进行底层网络操作, 当使用`--proxy`选项时, Grab会给出一条警告消息.
|
||||
|
||||
## 程序列表详解
|
||||
|
||||
官方会维护一份[官方程序列表](programs.info). 通过使用`grab update`命令可以使用官方程序列表更新您本地的程序列表.
|
||||
|
||||
您可以通过`grab add 程序列表`来添加程序列表中的程序到本地程序列表中. 给定的程序列表参数可以是本地文件名或网址.
|
||||
|
||||
参见[程序列表样例](programs_zhCN.info.example)获取更详细的信息.
|
|
@ -31,3 +31,5 @@
|
|||
使用以下命令启动 脚本安装器:
|
||||
|
||||
`grab`
|
||||
|
||||
可通过查看[Grab文档](DOC_Grab_zhCN.md)了解更多用法.
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
-- 这是一份程序列表样例
|
||||
-- 在您的发布版程序列表中,请不要添加任何注释
|
||||
|
||||
-- 此文件包含一个表
|
||||
-- 表中每个键被当作包标识符(包名). 键必须是字符串.
|
||||
-- 表中每个值被当作对应包的信息. 值必须是表.
|
||||
-- 包标识符(包名)不应包含空格符.
|
||||
-- 包标识符(包名)应是唯一的. 具有相同包标识符的信息会被覆盖.
|
||||
|
||||
-- 特别提示: 请不要使用中文作为包标识符. 此文件只是个样例.
|
||||
|
||||
["填入包标识符"]={
|
||||
title="在这里写入包的全名",
|
||||
info="此处填写包的基本信息. grab show会展示这些信息.",
|
||||
|
||||
files={
|
||||
-- 键是数字, 值是字符串. 值指定的文件会被下载到当前文件夹并命名为值.
|
||||
"somefile.lua",
|
||||
|
||||
-- 键是字符串, 值是字符串. 键指定的文件会被下载到值指定的位置.
|
||||
["anotherfile.lua"]="/tmp/place_it_here.lua",
|
||||
|
||||
-- 键是字符串, 值是表.
|
||||
-- 键指定的文件将被下载,并尝试存入从值表第一个开始指定的位置.
|
||||
["otherfile.lua"]={
|
||||
"/etc/somedir/some_name.lua",
|
||||
"/tmp/another_name.lua",
|
||||
},
|
||||
|
||||
-- 文件名也可以包含路径信息.
|
||||
"placed/here/my_source.lua"
|
||||
},
|
||||
|
||||
-- 可选.
|
||||
-- 在此处填写依赖的包标识符(包名)
|
||||
requires={
|
||||
"libevent"
|
||||
},
|
||||
|
||||
-- 可选. `grab show`会展示这些信息.
|
||||
author="作者",
|
||||
contact="联系方式",
|
||||
|
||||
-- 可选
|
||||
-- 当包在Github上的其他仓库时, 指定此字段.
|
||||
repo="用户/仓库",
|
||||
|
||||
-- 可选
|
||||
-- 当包在Github上的仓库的其他分支时, 指定此字段.
|
||||
branch="分支名称",
|
||||
|
||||
-- 可选
|
||||
-- 如果此字段存在, Grab会使用其来生成Url. (这会覆盖命令行中指定的路由函数)
|
||||
-- __repo__ 会被替换为repo字段或官方仓库名.
|
||||
-- __branch__ 会被替换为branch字段或"master"
|
||||
-- __file__ 会被替换为下载的文件名.
|
||||
proxy="http://SomeServer.com/__repo__/__branch__/__file__",
|
||||
|
||||
-- 可选
|
||||
-- 如果此字段存在, 在文件下载完成后, 其将被载入并执行
|
||||
-- 安装脚本必须包含在files表中.
|
||||
installer="somefile.lua",
|
||||
|
||||
-- 可选 (但很重要)
|
||||
-- 如果此字段存在, Grab会询问用户是否同意指定的协议.
|
||||
-- 如果此字段不存在, 该包将被认为基于 The Unlicense (http://unlicense.org/) 协议.
|
||||
-- 需要注意的是所有官方库的文件都基于 MIT协议 (https://github.com/Kiritow/OpenComputerScripts/blob/master/LICENSE)
|
||||
license={
|
||||
name="MIT",
|
||||
url="协议的具体地址"
|
||||
}
|
||||
},
|
||||
|
||||
["另外一个包"]={
|
||||
...
|
||||
},
|
||||
|
||||
...
|
||||
}
|
Loading…
Reference in New Issue