diff --git a/docs/en-us/manual/cli/config.md b/docs/en-us/manual/cli/config.md index d702c8b178..b9d0d8d251 100644 --- a/docs/en-us/manual/cli/config.md +++ b/docs/en-us/manual/cli/config.md @@ -422,11 +422,24 @@ backend = "libgit2" # the backend of resource, can be "libgit2" or "git" # the remote of resource [resource.remote] -branch = "main" # the branch of remote repository -# the url of remote repository, when using ssh, you should set ssh_key field -url = "https://github.com/MaaAssistantArknights/MaaResource.git" -# url = "git@github.com:MaaAssistantArknights/MaaResource.git" -# ssh_key = "~/.ssh/id_ed25519" # path to ssh key +branch = "main" # Branch of remote resource repository +# URL of remote resource repository, leave it empty to use the default URL +url = "git@github.com:MaaAssistantArknights/MaaResource.git" +# If you want to use ssh, a certificate is needed which can be "ssh-agent" or "ssh-key" +# To use ssh-agent, set `use_ssh_agent` to true, and leave `ssh_key` and `passphrase` empty +# use_ssh_agent = true # Use ssh-agent to authenticate +# To use ssh-key, set `ssh_key` to path of ssh key, +ssh_key = "~/.ssh/id_ed25519" # Path of ssh key +# A Passphrase is needed if the ssh key is encrypted +passphrase = "password" # Passphrase of ssh key +# Store plain text password in configuration file is unsafe, so there are some ways to avoid it +# 1. set `passphrase` to true, then maa-cli will prompt you to input passphrase each time +# passphrase = true +# 2. set `passphrase` to a environment variable, then maa-cli will use the environment variable as passphrase +# passphrase = { env = "MAA_SSH_PASSPHRASE" } +# 3. set `passphrase` to a command, then maa-cli will execute the command to get passphrase +# which is useful when you use a password manager to manage your passphrase +# passphrase = { cmd = ["pass", "show", "ssh/id_ed25519"] } ``` **NOTE**: diff --git a/docs/en-us/manual/cli/usage.md b/docs/en-us/manual/cli/usage.md index a75331c3a3..a5bbc66a4a 100644 --- a/docs/en-us/manual/cli/usage.md +++ b/docs/en-us/manual/cli/usage.md @@ -42,11 +42,13 @@ After installing and configuring MaaCore, you can run tasks. maa-cli supports tw ### Predefined tasks -- `maa startup [client]`: start the game client and enter the main screen, the `client` is the client type of game, leave it empty to don't start the game; -- `maa closedown [client]`: close the game client, the `client` is the client type of game, default is `Official`; -- `maa fight [stage]`: run a "fight" task, the `stage` is the stage to fight, like `1-7`, `CE-6`, etc.; if not given, the user will be prompted to input one; -- `maa copilot `: run a "copilot" task, the `maa_uri` is the URI of a copilot task; it can be `maa://1234` or local file path; +- `maa startup [client]`: start the game client and enter the main screen, the `client` is the client type of game, leave it empty to don't start the game. +- `maa closedown [client]`: close the game client, the `client` is the client type of game, default is `Official`. +- `maa fight [stage]`: run a "fight" task, the `stage` is the stage to fight, like `1-7`, `CE-6`, etc.; if not given, the user will be prompted to input one. +- `maa copilot ...`: run a "copilot" task, the `maa_uri` is the URI of a copilot task, multiple URIs will be executed in sequence, `maa_uri` can be `maa://1234` or local file path `./1234.json`. +- `maa sscopilot `: run a "sscopilot" task, the `maa_uri` is the URI of a sscopilot task. - `maa roguelike [theme]`: run a "roguelike" task, the `theme` is the theme of roguelike, and available themes are `Phantom`, `Mizuki`, `Sami` and `Sarkaz`. +- `maa reclamation [theme]`: run a "reclamation" task, the `theme` is the theme of reclamation, and available themes are `Tales`. The above tasks accept some parameters, you can view the specific parameters by `maa --help`. diff --git a/docs/ja-jp/manual/cli/config.md b/docs/ja-jp/manual/cli/config.md index ff1ae9f243..a8842ff2fc 100644 --- a/docs/ja-jp/manual/cli/config.md +++ b/docs/ja-jp/manual/cli/config.md @@ -15,7 +15,7 @@ maa-cli 配置文件位于特定的配置目录中,你可以通过 `maa dir co 所有的配置文件都可以使用 TOML,YAML 或者 JSON 格式,在下面的例子中,我们将使用 TOML 格式,并使用 `.toml` 作为文件扩展名。但是你可以混合这三种格式中的任意一种,只要你的文件扩展名正确。 -此外,部份任务接受 `filename` 作为参数,如果你使用相对路径,那么相对路径将会相对于配置目录的对应子目录。比如自定义基建计划文件的相对路径应该相对于 `$MAA_CONFIG_DIR/infrast`,而保全派驻的作业文件则相对于 `$MAA_CONFIG_DIR/ssscopilot`。 +此外,部分任务接受 `filename` 作为参数,如果你使用相对路径,那么相对路径将会相对于配置目录的对应子目录。比如自定义基建计划文件的相对路径应该相对于 `$MAA_CONFIG_DIR/infrast`,而保全派驻的作业文件则相对于 `$MAA_CONFIG_DIR/ssscopilot`。 ## 自定义任务 @@ -413,19 +413,41 @@ backend = "libgit2" # 资源热更新后端,可选值为 "git" 或者 "libgit2 # 资源热更新远程仓库相关配置 [resource.remote] branch = "main" # 远程仓库的分支,默认为 "main" -# 远程仓库的 url,如果你想要使用 ssh,你必须配置 ssh_key 的路径 +# 远程资源仓库的 URL,留空以使用默认 URL +# GitHub 仓库支持 HTTPS 和 SSH 两种协议访问,建议使用 HTTPS 协议,因为通常情况下不需要额外配置 url = "https://github.com/MaaAssistantArknights/MaaResource.git" # url = "git@github.com:MaaAssistantArknights/MaaResource.git" -# ssh_key = "~/.ssh/id_ed25519" # path to ssh key +# 如果你必须使用 SSH 协议,你需要提供 SSH 密钥,最简单的方法是提供密钥的路径 +ssh_key = "~/.ssh/id_ed25519" # ssh 密钥的路径 +# maa 默认密钥是未加密的,如果你的密钥是受密码保护的,你需要提供密码来解密密钥 +# 注意:只有你使用 libgit2 后端时 maa 才会将密码传递给 libgit2 +# 当你使用 git 后端时,git 会自己提示你输入密码 +# 如果你使用 git 后端且你的密钥受密码保护,请使用 ssh-agent 来管理你的密钥 +passphrase = "password" # ssh 密钥的密码 +# 然而在配置文件中存储明文密码是不安全的,因此有一些方法可以避免这种情况 +# 1. 将 `passphrase` 设置为 true,然后 maa-cli 将每次提示你输入密码 +# 这种方法安全但是较为繁琐且无法在 batch 模式下使用 +# passphrase = true +# 2. 将 `passphrase` 设置为环境变量名,然后 maa-cli 将使用环境变量作为密码 +# 这种方法比明文密码更安全,但是仍然有一定的风险,因为环境变量可能被任何程序访问 +# passphrase = { env = "MAA_SSH_PASSPHRASE" } +# 3. 将 `passphrase` 设置为命令,然后 maa-cli 将执行该命令以获取密码 +# 如果你使用了密码管理器来管理你的密码,这种方法可能是最安全的且方便的 +# passphrase = { cmd = ["pass", "show", "ssh/id_ed25519"] } +# 4. 使用 ssh-agent 来管理你的密钥,**推荐** +# ssh-agent 会将你的密钥保存在内存中,这样你就不需要每次输入密码 +# 注意,你需要确保 ssh-agent 已经启动并且已经添加了你的密钥,同时 SSH_AUTH_SOCK 环境变量已经设置 +# use_ssh_agent = true # 使用 ssh-agent 进行身份验证,如果设置为 true,将忽略 ssh_key 和 passphrase 字段 ``` **注意事项**: - MaaCore 的更新通道中 `Alpha` 只在 Windows 上可用; - 由于 CLI 默认的 API 链接和下载链接都是 GitHub 的链接,因此在国内可能会有一些问题,你可以通过配置 `api_url` 和 `download_url` 来使用镜像。 -- 即使启动了资源热更新,你依然需要安装 MaaCore 的资源,因为资源热更新并不包含所有的资源文件,只是包含部份可更新的资源文件,基础资源文件仍然需要安装。 +- 即使启动了资源热更新,你依然需要安装 MaaCore 的资源,因为资源热更新并不包含所有的资源文件,只是包含部分可更新的资源文件,基础资源文件仍然需要安装。 - 资源热更新是通过 Git 来拉取远程仓库,如果后端设置为 `git` 那么 `git` 命令行工具必须可用。 - 如果你想要使用 SSH 协议来拉取远程仓库,你必须配置 `ssh_key` 字段,这个字段应该是一个路径,指向你的 SSH 私钥。 +- 如果你的 SSH 私钥是受密码保护的,你需要提供密码来解密私钥,或者使用 ssh-agent 来管理你的密钥。 - 远程仓库的 `url` 设置目前只对首次安装资源有效,如果你想要更改远程仓库的地址,你需要通过 `git` 命令行工具手动更改,或者删除对应的仓库。仓库所在位置可以通过 `maa dir hot-update` 获取。 ## 参考配置 diff --git a/docs/ja-jp/manual/cli/usage.md b/docs/ja-jp/manual/cli/usage.md index 92cae3a536..ffac489f7f 100644 --- a/docs/ja-jp/manual/cli/usage.md +++ b/docs/ja-jp/manual/cli/usage.md @@ -48,11 +48,13 @@ maa init 对于常见任务,maa-cli 提供了一些预定义的任务: -- `maa startup [client]`: 启动游戏并进入主界面,`[client]` 是客户端类型,如果留空则不会启动游戏客户端; -- `maa closedown [client]`: 关闭游戏客户端,`[client]` 是客户端类型,默认为 `Official`; -- `maa fight [stage]`: 运行战斗任务,`[stage]` 是关卡名称,例如 `1-7`;留空选择上次或者当前关卡; -- `maa copilot `: 运行自动战斗任务,其中 `` 是作业的 URI,其可以是 `maa://1234` 或者本地文件路径 `./1234.json`; -- `maa roguelike [theme]`: 自动集成战略,`[theme]` 是集成战略的主题,可选值为 `Phantom`,`Mizuki`,`Sami` 以及 `Sarkaz`; +- `maa startup [client]`: 启动游戏并进入主界面,`[client]` 是客户端类型,如果留空则不会启动游戏客户端。 +- `maa closedown [client]`: 关闭游戏客户端,`[client]` 是客户端类型,默认为 `Official`。 +- `maa fight [stage]`: 运行战斗任务,`[stage]` 是关卡名称,例如 `1-7`;留空选择上次或者当前关卡。 +- `maa copilot ...`: 自动抄作业,其中 `` 是作业的 URI,多个 URI 会依次执行,`maa_uri` 可以是 `maa://1234` 或者 本地文件路径 `./1234.json`。 +- `maa sscopilot `: 自动保全派驻,其中 `` 是保全派驻作业的 URI。 +- `maa roguelike `: 自动集成战略,`` 是集成战略的主题,可选值为 `Phantom`,`Mizuki`,`Sami` 以及 `Sarkaz`。 +- `maa reclamation `: 自动生息演算,`` 是生息演算的主题,目前仅 `Tales` 主题可用。 上述任务接受一些参数,你可以通过 `maa --help` 来查看具体的参数。 @@ -69,7 +71,7 @@ maa startup Official && maa fight BB-7 -m 3 && maa closedown ### 任务总结 不管是预定义任务还是自定义任务,maa-cli 都会在任务运行结束后输出任务的总结信息, -其包括每个子任务的运行时间(开始时间、结束时间、运行时长)。对于部份任务,还会输出任务的结果汇总: +其包括每个子任务的运行时间(开始时间、结束时间、运行时长)。对于部分任务,还会输出任务的结果汇总: - `fight` 任务: 关卡名称,次数,消耗理智药个数以及掉落统计; - `infrast`: 各设施进驻的干员,对于制造站和贸易站,还会包括产物类型; diff --git a/docs/ko-kr/manual/cli/config.md b/docs/ko-kr/manual/cli/config.md index ed1ac1d576..d06064d046 100644 --- a/docs/ko-kr/manual/cli/config.md +++ b/docs/ko-kr/manual/cli/config.md @@ -403,13 +403,25 @@ binary = true # maa-cli 바이너리 파일을 설치할지 여부, 기본값은 auto_update = true # 각 작업 실행 시 리소스를 자동 업데이트할지 여부, 기본값은 false backend = "libgit2" # 리소스 핫 업데이트 백엔드, 가능한 값은 "git" 또는 "libgit2", 기본값은 "git" -# 리소스 핫 업데이트 원격 저장소 관련 설정 [resource.remote] -branch = "main" # 원격 저장소의 분기, 기본값은 "main" -# 원격 저장소의 URL, ssh를 사용하려면 ssh_key 경로를 설정해야 함 -url = "https://github.com/MaaAssistantArknights/MaaResource.git" -# url = "git@github.com:MaaAssistantArknights/MaaResource.git" -# ssh_key = "~/.ssh/id_ed25519" # ssh 키 경로 +branch = "main" # 원격 저장소의 브랜치, 기본값은 "main"입니다. +# 원격 리소스 저장소의 URL, 기본 URL을 사용하려면 비워 두세요. +url = "git@github.com:MaaAssistantArknights/MaaResource.git" +# ssh를 사용하려면 인증 방식을 구성해야 하며, "ssh-agent" 또는 "ssh-key" 중 하나를 사용할 수 있습니다. +# ssh-agent를 사용하려면 `use_ssh_agent`를 true로 설정하고, `ssh_key`와 `passphrase`는 비워 두세요. +# use_ssh_agent = true # ssh-agent를 사용하여 인증 +# ssh-key를 사용하려면 `ssh_key`에 ssh 키의 경로를 설정하세요. +ssh_key = "~/.ssh/id_ed25519" # ssh 키의 경로 +# ssh 키가 암호화된 경우, 암호를 입력해야 합니다. +passphrase = "password" # ssh 키의 암호 +# 설정 파일에 평문 암호를 저장하는 것은 안전하지 않으므로 이를 방지하기 위한 방법이 있습니다. +# 1. `passphrase`를 true로 설정하면, maa-cli가 매번 암호를 입력하라고 요청합니다. +# passphrase = true +# 2. `passphrase`를 환경 변수 이름으로 설정하면, maa-cli는 해당 환경 변수를 암호로 사용합니다. +# passphrase = { env = "MAA_SSH_PASSPHRASE" } +# 3. `passphrase`를 명령어로 설정하면, maa-cli는 해당 명령어를 실행하여 암호를 가져옵니다. +# 이는 암호 관리자를 사용하여 암호를 관리할 때 매우 유용합니다. +# passphrase = { cmd = ["pass", "show", "ssh/id_ed25519"] } ``` **주의사항**: diff --git a/docs/ko-kr/manual/cli/usage.md b/docs/ko-kr/manual/cli/usage.md index 1ed8a19a32..1204c8d8d0 100644 --- a/docs/ko-kr/manual/cli/usage.md +++ b/docs/ko-kr/manual/cli/usage.md @@ -47,8 +47,10 @@ MaaCore의 설치 및 구성을 완료하면 작업을 실행할 준비가 된 - `maa startup [client]`: 게임을 시작하고 메인 화면으로 이동합니다. `[client]`는 클라이언트 유형이며, 생략하면 게임 클라이언트를 시작하지 않습니다. - `maa closedown [client]`: 게임 클라이언트를 종료합니다. `[client]`는 클라이언트 유형이며, 기본값은 `Official`입니다. - `maa fight [stage]`: 전투 작업을 실행합니다. `[stage]`는 스테이지 이름이며, 예를 들어 `1-7`입니다. 생략하면 이전 또는 현재 스테이지를 선택합니다. -- `maa copilot `: 자동 전투 작업을 실행합니다. ``는 작업의 URI로 `maa://1234` 또는 로컬 파일 경로 `./1234.json`일 수 있습니다. -- `maa roguelike [theme]`: 자동 통합 전략을 실행합니다. `[theme]`는 통합 전략의 주제이며, 선택 가능한 값은 `Phantom`, `Mizuki`, `Sami`, `Sarkaz`입니다. +- `maa copilot ...`: 자동 전투 작업을 실행합니다. ``는 작업의 URI이며, 여러 URI는 순차적으로 실행됩니다. `maa_uri`는 `maa://1234` 또는 로컬 파일 경로 `./1234.json`일 수 있습니다. +- `maa sscopilot `: 자동 보안 파견을 실행합니다. ``는 보안 파견 작업의 URI입니다. +- `maa roguelike `: 자동 통합 전략을 실행합니다. ``는 통합 전략의 주제이며, 선택 가능한 값은 `Phantom`, `Mizuki`, `Sami`, `Sarkaz`입니다. +- `maa reclamation `: 자동 생활 게임을 실행합니다. ``는 생활 게임의 주제이며, 현재 사용 가능한 값은 `Tales`입니다. 위 작업들은 몇 가지 매개변수를 받습니다. `maa --help` 명령어를 통해 자세한 매개변수를 확인할 수 있습니다. diff --git a/docs/zh-cn/manual/cli/config.md b/docs/zh-cn/manual/cli/config.md index 3a7fcfae10..93105ad521 100644 --- a/docs/zh-cn/manual/cli/config.md +++ b/docs/zh-cn/manual/cli/config.md @@ -409,19 +409,41 @@ backend = "libgit2" # 资源热更新后端,可选值为 "git" 或者 "libgit2 # 资源热更新远程仓库相关配置 [resource.remote] branch = "main" # 远程仓库的分支,默认为 "main" -# 远程仓库的 url,如果你想要使用 ssh,你必须配置 ssh_key 的路径 +# 远程资源仓库的 URL,留空以使用默认 URL +# GitHub 仓库支持 HTTPS 和 SSH 两种协议访问,建议使用 HTTPS 协议,因为通常情况下不需要额外配置 url = "https://github.com/MaaAssistantArknights/MaaResource.git" # url = "git@github.com:MaaAssistantArknights/MaaResource.git" -# ssh_key = "~/.ssh/id_ed25519" # path to ssh key +# 如果你必须使用 SSH 协议,你需要提供 SSH 密钥,最简单的方法是提供密钥的路径 +ssh_key = "~/.ssh/id_ed25519" # ssh 密钥的路径 +# maa 默认密钥是未加密的,如果你的密钥是受密码保护的,你需要提供密码来解密密钥 +# 注意:只有你使用 libgit2 后端时 maa 才会将密码传递给 libgit2 +# 当你使用 git 后端时,git 会自己提示你输入密码 +# 如果你使用 git 后端且你的密钥受密码保护,请使用 ssh-agent 来管理你的密钥 +passphrase = "password" # ssh 密钥的密码 +# 然而在配置文件中存储明文密码是不安全的,因此有一些方法可以避免这种情况 +# 1. 将 `passphrase` 设置为 true,然后 maa-cli 将每次提示你输入密码 +# 这种方法安全但是较为繁琐且无法在 batch 模式下使用 +# passphrase = true +# 2. 将 `passphrase` 设置为环境变量名,然后 maa-cli 将使用环境变量作为密码 +# 这种方法比明文密码更安全,但是仍然有一定的风险,因为环境变量可能被任何程序访问 +# passphrase = { env = "MAA_SSH_PASSPHRASE" } +# 3. 将 `passphrase` 设置为命令,然后 maa-cli 将执行该命令以获取密码 +# 如果你使用了密码管理器来管理你的密码,这种方法可能是最安全的且方便的 +# passphrase = { cmd = ["pass", "show", "ssh/id_ed25519"] } +# 4. 使用 ssh-agent 来管理你的密钥,**推荐** +# ssh-agent 会将你的密钥保存在内存中,这样你就不需要每次输入密码 +# 注意,你需要确保 ssh-agent 已经启动并且已经添加了你的密钥,同时 SSH_AUTH_SOCK 环境变量已经设置 +# use_ssh_agent = true # 使用 ssh-agent 进行身份验证,如果设置为 true,将忽略 ssh_key 和 passphrase 字段 ``` **注意事项**: - MaaCore 的更新通道中 `Alpha` 只在 Windows 上可用; - 由于 CLI 默认的 API 链接和下载链接都是 GitHub 的链接,因此在国内可能会有一些问题,你可以通过配置 `api_url` 和 `download_url` 来使用镜像。 -- 即使启动了资源热更新,你依然需要安装 MaaCore 的资源,因为资源热更新并不包含所有的资源文件,只是包含部份可更新的资源文件,基础资源文件仍然需要安装。 +- 即使启动了资源热更新,你依然需要安装 MaaCore 的资源,因为资源热更新并不包含所有的资源文件,只是包含部分可更新的资源文件,基础资源文件仍然需要安装。 - 资源热更新是通过 Git 来拉取远程仓库,如果后端设置为 `git` 那么 `git` 命令行工具必须可用。 - 如果你想要使用 SSH 协议来拉取远程仓库,你必须配置 `ssh_key` 字段,这个字段应该是一个路径,指向你的 SSH 私钥。 +- 如果你的 SSH 私钥是受密码保护的,你需要提供密码来解密私钥,或者使用 ssh-agent 来管理你的密钥。 - 远程仓库的 `url` 设置目前只对首次安装资源有效,如果你想要更改远程仓库的地址,你需要通过 `git` 命令行工具手动更改,或者删除对应的仓库。仓库所在位置可以通过 `maa dir hot-update` 获取。 ## 参考配置 diff --git a/docs/zh-cn/manual/cli/usage.md b/docs/zh-cn/manual/cli/usage.md index 295fa79b06..3dab3f317c 100644 --- a/docs/zh-cn/manual/cli/usage.md +++ b/docs/zh-cn/manual/cli/usage.md @@ -44,11 +44,13 @@ maa init 对于常见任务,maa-cli 提供了一些预定义的任务: -- `maa startup [client]`: 启动游戏并进入主界面,`[client]` 是客户端类型,如果留空则不会启动游戏客户端; -- `maa closedown [client]`: 关闭游戏客户端,`[client]` 是客户端类型,默认为 `Official`; -- `maa fight [stage]`: 运行战斗任务,`[stage]` 是关卡名称,例如 `1-7`;留空选择上次或者当前关卡; -- `maa copilot `: 运行自动战斗任务,其中 `` 是作业的 URI,其可以是 `maa://1234` 或者本地文件路径 `./1234.json`; -- `maa roguelike [theme]`: 自动集成战略,`[theme]` 是集成战略的主题,可选值为 `Phantom`,`Mizuki`,`Sami` 以及 `Sarkaz`; +- `maa startup [client]`: 启动游戏并进入主界面,`[client]` 是客户端类型,如果留空则不会启动游戏客户端。 +- `maa closedown [client]`: 关闭游戏客户端,`[client]` 是客户端类型,默认为 `Official`。 +- `maa fight [stage]`: 运行战斗任务,`[stage]` 是关卡名称,例如 `1-7`;留空选择上次或者当前关卡。 +- `maa copilot ...`: 自动抄作业,其中 `` 是作业的 URI,多个 URI 会依次执行,`maa_uri` 可以是 `maa://1234` 或者 本地文件路径 `./1234.json`。 +- `maa sscopilot `: 自动保全派驻,其中 `` 是保全派驻作业的 URI。 +- `maa roguelike `: 自动集成战略,`` 是集成战略的主题,可选值为 `Phantom`,`Mizuki`,`Sami` 以及 `Sarkaz`。 +- `maa reclamation `: 自动生息演算,`` 是生息演算的主题,目前仅 `Tales` 主题可用。 上述任务接受一些参数,你可以通过 `maa --help` 来查看具体的参数。 @@ -65,7 +67,7 @@ maa startup Official && maa fight BB-7 -m 3 && maa closedown ### 任务总结 不管是预定义任务还是自定义任务,maa-cli 都会在任务运行结束后输出任务的总结信息, -其包括每个子任务的运行时间(开始时间、结束时间、运行时长)。对于部份任务,还会输出任务的结果汇总: +其包括每个子任务的运行时间(开始时间、结束时间、运行时长)。对于部分任务,还会输出任务的结果汇总: - `fight` 任务: 关卡名称,次数,消耗理智药个数以及掉落统计; - `infrast`: 各设施进驻的干员,对于制造站和贸易站,还会包括产物类型; diff --git a/docs/zh-tw/manual/cli/config.md b/docs/zh-tw/manual/cli/config.md index ff1ae9f243..75d76db078 100644 --- a/docs/zh-tw/manual/cli/config.md +++ b/docs/zh-tw/manual/cli/config.md @@ -15,7 +15,7 @@ maa-cli 配置文件位于特定的配置目录中,你可以通过 `maa dir co 所有的配置文件都可以使用 TOML,YAML 或者 JSON 格式,在下面的例子中,我们将使用 TOML 格式,并使用 `.toml` 作为文件扩展名。但是你可以混合这三种格式中的任意一种,只要你的文件扩展名正确。 -此外,部份任务接受 `filename` 作为参数,如果你使用相对路径,那么相对路径将会相对于配置目录的对应子目录。比如自定义基建计划文件的相对路径应该相对于 `$MAA_CONFIG_DIR/infrast`,而保全派驻的作业文件则相对于 `$MAA_CONFIG_DIR/ssscopilot`。 +此外,部分任务接受 `filename` 作为参数,如果你使用相对路径,那么相对路径将会相对于配置目录的对应子目录。比如自定义基建计划文件的相对路径应该相对于 `$MAA_CONFIG_DIR/infrast`,而保全派驻的作业文件则相对于 `$MAA_CONFIG_DIR/ssscopilot`。 ## 自定义任务 @@ -412,20 +412,41 @@ backend = "libgit2" # 资源热更新后端,可选值为 "git" 或者 "libgit2 # 资源热更新远程仓库相关配置 [resource.remote] -branch = "main" # 远程仓库的分支,默认为 "main" -# 远程仓库的 url,如果你想要使用 ssh,你必须配置 ssh_key 的路径 +# 远程资源仓库的 URL,留空以使用默认 URL +# GitHub 仓库支持 HTTPS 和 SSH 两种协议访问,建议使用 HTTPS 协议,因为通常情况下不需要额外配置 url = "https://github.com/MaaAssistantArknights/MaaResource.git" # url = "git@github.com:MaaAssistantArknights/MaaResource.git" -# ssh_key = "~/.ssh/id_ed25519" # path to ssh key +# 如果你必须使用 SSH 协议,你需要提供 SSH 密钥,最简单的方法是提供密钥的路径 +ssh_key = "~/.ssh/id_ed25519" # ssh 密钥的路径 +# maa 默认密钥是未加密的,如果你的密钥是受密码保护的,你需要提供密码来解密密钥 +# 注意:只有你使用 libgit2 后端时 maa 才会将密码传递给 libgit2 +# 当你使用 git 后端时,git 会自己提示你输入密码 +# 如果你使用 git 后端且你的密钥受密码保护,请使用 ssh-agent 来管理你的密钥 +passphrase = "password" # ssh 密钥的密码 +# 然而在配置文件中存储明文密码是不安全的,因此有一些方法可以避免这种情况 +# 1. 将 `passphrase` 设置为 true,然后 maa-cli 将每次提示你输入密码 +# 这种方法安全但是较为繁琐且无法在 batch 模式下使用 +# passphrase = true +# 2. 将 `passphrase` 设置为环境变量名,然后 maa-cli 将使用环境变量作为密码 +# 这种方法比明文密码更安全,但是仍然有一定的风险,因为环境变量可能被任何程序访问 +# passphrase = { env = "MAA_SSH_PASSPHRASE" } +# 3. 将 `passphrase` 设置为命令,然后 maa-cli 将执行该命令以获取密码 +# 如果你使用了密码管理器来管理你的密码,这种方法可能是最安全的且方便的 +# passphrase = { cmd = ["pass", "show", "ssh/id_ed25519"] } +# 4. 使用 ssh-agent 来管理你的密钥,**推荐** +# ssh-agent 会将你的密钥保存在内存中,这样你就不需要每次输入密码 +# 注意,你需要确保 ssh-agent 已经启动并且已经添加了你的密钥,同时 SSH_AUTH_SOCK 环境变量已经设置 +# use_ssh_agent = true # 使用 ssh-agent 进行身份验证,如果设置为 true,将忽略 ssh_key 和 passphrase 字段 ``` **注意事项**: - MaaCore 的更新通道中 `Alpha` 只在 Windows 上可用; - 由于 CLI 默认的 API 链接和下载链接都是 GitHub 的链接,因此在国内可能会有一些问题,你可以通过配置 `api_url` 和 `download_url` 来使用镜像。 -- 即使启动了资源热更新,你依然需要安装 MaaCore 的资源,因为资源热更新并不包含所有的资源文件,只是包含部份可更新的资源文件,基础资源文件仍然需要安装。 +- 即使启动了资源热更新,你依然需要安装 MaaCore 的资源,因为资源热更新并不包含所有的资源文件,只是包含部分可更新的资源文件,基础资源文件仍然需要安装。 - 资源热更新是通过 Git 来拉取远程仓库,如果后端设置为 `git` 那么 `git` 命令行工具必须可用。 - 如果你想要使用 SSH 协议来拉取远程仓库,你必须配置 `ssh_key` 字段,这个字段应该是一个路径,指向你的 SSH 私钥。 +- 如果你的 SSH 私钥是受密码保护的,你需要提供密码来解密私钥,或者使用 ssh-agent 来管理你的密钥。 - 远程仓库的 `url` 设置目前只对首次安装资源有效,如果你想要更改远程仓库的地址,你需要通过 `git` 命令行工具手动更改,或者删除对应的仓库。仓库所在位置可以通过 `maa dir hot-update` 获取。 ## 参考配置 diff --git a/docs/zh-tw/manual/cli/usage.md b/docs/zh-tw/manual/cli/usage.md index 92cae3a536..ffac489f7f 100644 --- a/docs/zh-tw/manual/cli/usage.md +++ b/docs/zh-tw/manual/cli/usage.md @@ -48,11 +48,13 @@ maa init 对于常见任务,maa-cli 提供了一些预定义的任务: -- `maa startup [client]`: 启动游戏并进入主界面,`[client]` 是客户端类型,如果留空则不会启动游戏客户端; -- `maa closedown [client]`: 关闭游戏客户端,`[client]` 是客户端类型,默认为 `Official`; -- `maa fight [stage]`: 运行战斗任务,`[stage]` 是关卡名称,例如 `1-7`;留空选择上次或者当前关卡; -- `maa copilot `: 运行自动战斗任务,其中 `` 是作业的 URI,其可以是 `maa://1234` 或者本地文件路径 `./1234.json`; -- `maa roguelike [theme]`: 自动集成战略,`[theme]` 是集成战略的主题,可选值为 `Phantom`,`Mizuki`,`Sami` 以及 `Sarkaz`; +- `maa startup [client]`: 启动游戏并进入主界面,`[client]` 是客户端类型,如果留空则不会启动游戏客户端。 +- `maa closedown [client]`: 关闭游戏客户端,`[client]` 是客户端类型,默认为 `Official`。 +- `maa fight [stage]`: 运行战斗任务,`[stage]` 是关卡名称,例如 `1-7`;留空选择上次或者当前关卡。 +- `maa copilot ...`: 自动抄作业,其中 `` 是作业的 URI,多个 URI 会依次执行,`maa_uri` 可以是 `maa://1234` 或者 本地文件路径 `./1234.json`。 +- `maa sscopilot `: 自动保全派驻,其中 `` 是保全派驻作业的 URI。 +- `maa roguelike `: 自动集成战略,`` 是集成战略的主题,可选值为 `Phantom`,`Mizuki`,`Sami` 以及 `Sarkaz`。 +- `maa reclamation `: 自动生息演算,`` 是生息演算的主题,目前仅 `Tales` 主题可用。 上述任务接受一些参数,你可以通过 `maa --help` 来查看具体的参数。 @@ -69,7 +71,7 @@ maa startup Official && maa fight BB-7 -m 3 && maa closedown ### 任务总结 不管是预定义任务还是自定义任务,maa-cli 都会在任务运行结束后输出任务的总结信息, -其包括每个子任务的运行时间(开始时间、结束时间、运行时长)。对于部份任务,还会输出任务的结果汇总: +其包括每个子任务的运行时间(开始时间、结束时间、运行时长)。对于部分任务,还会输出任务的结果汇总: - `fight` 任务: 关卡名称,次数,消耗理智药个数以及掉落统计; - `infrast`: 各设施进驻的干员,对于制造站和贸易站,还会包括产物类型; diff --git a/src/maa-cli b/src/maa-cli index 1411b797f1..bd30ef0f3a 160000 --- a/src/maa-cli +++ b/src/maa-cli @@ -1 +1 @@ -Subproject commit 1411b797f1f3535bc92773f436f189728848ea9c +Subproject commit bd30ef0f3a31a146d2df03d69621e809a6e23622