命令行工具 CLI 使用指南
命令行工具(tds)是用来部署云引擎应用和进行其他管理操作的客户端工具。
安装
macOS
推荐通过 Homebrew 安装:
brew update && brew install lean-cli
点击展开 Homebrew 安装常见问题
如访问 Homebrew 网络不畅,可以 设置 http_proxy 等环境变量来加速访问,或为 Homebrew 配置镜像源(如 TUNA)。
如不希望通过 Homebrew 安装,可以在 GitHub releases 页面 下载二进制文件 tds-macos-arm64(Apple Silicon)或 tds-macos-x64(Intel),重命名为 tds 后移动到 $PATH 下的路径,并添加可执行权限(chmod a+x /path/to/tds)。
Windows
Windows 用户可以在 GitHub releases 页面 根据操作系统版本下载最新的 32 位 或 64 位 msi 安装包进行安装,安装成功之后在 Windows 命令提示符(或 PowerShell)下直接 输入 tds 命令即可使用。
也可以选择编译好的绿色版 exe 文件,下载后将此文件更名为 tds.exe,并将其路径加入到系统 PATH 环境变量(设置方法)中去。这样使用时在 Windows 命令提示符(或 PowerShell)下,在任意目录下输入 tds 就可以使用命令行工具了。当然也可以将此文件直接放到已经在 PATH 环境变量中声明的任意目录中去,比如 C:\Windows\System32 中。
Linux
基于 Debian 的发行版可以从 GitHub releases 页面 下载 deb 包安装。
其他发行版可以从 GitHub releases 页面 下载预编译好的二进制文件(如 tds-linux-x64),重命名为 tds 后移动到 $PATH 下的路径,并添加可执行权限(chmod a+x /path/to/tds)。
升级版本
下载最新的文件,重新执行一遍安装流程,即可把旧版本的命令行工具覆盖,升级到最新版。
命令介绍
安装成功之后,直接在 terminal 终端运行 tds help,输出帮助信息:
点击展开 tds help 的输出
NAME:
tds - Command line tool to manage and deploy Cloud Engine apps
USAGE:
tds [global options] command [command options] [arguments...]
VERSION:
1.0.0
COMMANDS:
login Log in to TapTap Developer Services
switch Change the associated Cloud Engine app
info Show information about the associated user and app
up Start a development instance locally with debug console
new Create a new Cloud Engine project from official examples
deploy Deploy the project to Cloud Engine
publish Publish the version of staging to production
db Access to to Database instances
file Manage files ('_File' class in Data Storage)
logs Show Cloud Engine logs
debug Start the debug console without running the project
env Print custom environment variables on Cloud Engine (secret variables not included)
cql Enter CQL interactive shell (warn: CQL is deprecated)
help Show usages of all subcommands
GLOBAL OPTIONS:
--version, -v print the version
可以通过 --version 选项查看命令行工具的版本:
$ tds --version
tds version 1.0.0
简单介绍下主要的子命令:
| 命令 | 用途 |
|---|---|
login | 登录账号 |
switch | 切换关联的云引擎应用和分组 |
info | 显示当前应用和分组信息 |
up | 启动本地开发调试 |
new | 从项目模板创建新项目 |
deploy | 部署项目至云引擎 |
publish | 将预备环境的版本发布至生产环境 |
db | 访问云端的 LeanCache 或 LeanDB |
file | 上传文件至数据存储服务(可以在 开发者中心 > 你的游戏 > 游戏服务 > 云服务 > 数据存储 > 文件 中查看) |
logs | 显示云引擎日志 |
debug | 单独启动云函数调试控制台(不运行应用本身) |
env |