docs: make Chinese README the default
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
<!-- WEHUB_ZH_README -->
|
||||
> [!NOTE]
|
||||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||||
> [English](./README.en.md) · [原始项目](https://github.com/homeport/termshot) · [上游 README](https://github.com/homeport/termshot/blob/HEAD/README.md)
|
||||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||||
|
||||
# termshot
|
||||
|
||||
[](https://github.com/homeport/termshot/blob/main/LICENSE)
|
||||
@@ -7,91 +13,91 @@
|
||||
[](https://pkg.go.dev/github.com/homeport/termshot)
|
||||
[](https://github.com/homeport/termshot/releases/latest)
|
||||
|
||||
Generate beautiful screenshots of your terminal, from your terminal.
|
||||
在终端中生成精美的终端截图。
|
||||
|
||||
```sh
|
||||
termshot lolcat -f <(figlet -f big termshot)
|
||||
```
|
||||
|
||||
This command generates this screenshot:
|
||||
该命令会生成如下截图:
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
## 安装
|
||||
|
||||
To install with Homebrew on macOS or Linux:
|
||||
在 macOS 或 Linux 上通过 Homebrew 安装:
|
||||
|
||||
```sh
|
||||
brew install homeport/tap/termshot
|
||||
```
|
||||
|
||||
See [Releases](https://github.com/homeport/termshot/releases/) for pre-compiled binaries for Darwin and Linux.
|
||||
请参阅 [Releases](https://github.com/homeport/termshot/releases/) 获取适用于 Darwin 和 Linux 的预编译二进制文件。
|
||||
|
||||
## Usage
|
||||
## 用法
|
||||
|
||||
This tool reads the console output and renders an output image that resembles a user interface window. It's inspired by some other web-based tools like [carbon.now.sh](https://carbon.now.sh/), and [codekeep.io/screenshot](https://codekeep.io/screenshot). Unlike those tools, `termshot` does not blindly apply syntax highlighting to some provided text; instead it reads the ANSI escape codes ("rich text") logged by most command-line tools and uses it to generate a high-fidelity "screenshot" of your terminal output.
|
||||
本工具读取控制台输出,并渲染成类似用户界面窗口的输出图像。其灵感来自一些基于 Web 的工具,例如 [carbon.now.sh](https://carbon.now.sh/), 和 [codekeep.io/screenshot](https://codekeep.io/screenshot).。与这些工具不同,`termshot` 不会对提供的文本盲目应用语法高亮;相反,它会读取大多数命令行工具记录的 ANSI 转义序列(「富文本」),并据此生成高保真的终端输出「截图」。
|
||||
|
||||
Like `time`, `watch`, or `perf`, just prefix the command you want to screenshot with `termshot`.
|
||||
与 `time`、`watch` 或 `perf` 类似,只需在你要截图的命令前加上 `termshot` 前缀。
|
||||
|
||||
```sh
|
||||
termshot ls -a
|
||||
```
|
||||
|
||||
This will generate an image file called `out.png` in the current directory.
|
||||
这将在当前目录生成名为 `out.png` 的图像文件。
|
||||
|
||||

|
||||

|
||||
|
||||
In some cases, if your target command contains _pipes_—there may still be ambiguity, even with `--`. In these cases, wrap your command in double quotes.
|
||||
在某些情况下,如果目标命令包含_管道_——即使使用 `--`,仍可能存在歧义。此时请用双引号将命令包裹起来。
|
||||
|
||||
```sh
|
||||
termshot -- "ls -1 | grep go"
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Flags to control the look
|
||||
### 控制外观的标志
|
||||
|
||||
#### `--show-cmd`/`-c`
|
||||
|
||||
Include the target command in the screenshot.
|
||||
在截图中包含目标命令。
|
||||
|
||||
```sh
|
||||
termshot --show-cmd -- "ls -a"
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
#### `--columns`/`-C`
|
||||
|
||||
Enforce that screenshot is wrapped after the provided number of columns. Use this flag to make sure that the screenshot does not exceed a certain horizontal length.
|
||||
强制在指定列数后换行。使用此标志可确保截图不超过一定的横向长度。
|
||||
|
||||
#### `--no-decoration`
|
||||
|
||||
Do not draw window decorations (minimize, maximize, and close button).
|
||||
不绘制窗口装饰(最小化、最大化和关闭按钮)。
|
||||
|
||||
#### `--no-shadow`
|
||||
|
||||
Do not draw window shadow.
|
||||
不绘制窗口阴影。
|
||||
|
||||
#### `--margin`/`-m`
|
||||
|
||||
Add extra space (margin) around the window.
|
||||
在窗口周围添加额外空白(外边距)。
|
||||
|
||||
#### `--padding`/`-p`
|
||||
|
||||
Add extra space (padding) around the content inside the window.
|
||||
在窗口内的内容周围添加额外空白(内边距)。
|
||||
|
||||
### Flags for output related settings
|
||||
### 与输出相关的标志
|
||||
|
||||
#### `--clipboard`/`-b` (only on selected platforms)
|
||||
#### `--clipboard`/`-b`(仅在部分平台上可用)
|
||||
|
||||
Do not create an output file with the screenshot, but save the screenshot image into the operating system clipboard.
|
||||
不创建包含截图的输出文件,而是将截图图像保存到操作系统剪贴板。
|
||||
|
||||
_Note:_ Only available on some platforms. Check `termshot` help to see if flag is available.
|
||||
_注意:_ 仅在部分平台上可用。运行 `termshot` help 可查看该标志是否可用。
|
||||
|
||||
#### `--filename`/`-f`
|
||||
|
||||
Specify a path where the screenshot should be generated. This can be an absolute path or a relative path; relative paths will be resolved relative to the current working directory. Defaults to `out.png`.
|
||||
指定生成截图的路径。可以是绝对路径或相对路径;相对路径将相对于当前工作目录解析。默认为 `out.png`。
|
||||
|
||||
```sh
|
||||
termshot -- "ls -a" # defaults to <cwd>/out.png
|
||||
@@ -100,41 +106,41 @@ termshot --filename screenshots/my-image.png -- "ls -a"
|
||||
termshot --filename /Desktop/my-image.png -- "ls -a"
|
||||
```
|
||||
|
||||
### Flags to control content
|
||||
### 控制内容的标志
|
||||
|
||||
#### `--edit`/`-e`
|
||||
|
||||
Edit the output before generating the screenshot. This will open the rich text output in the editor configured in `$EDITOR`, using `vi` as a fallback. Use this flag to remove unwanted or sensitive output.
|
||||
在生成截图前编辑输出。这会在 `$EDITOR` 中配置的编辑器中打开富文本输出,并以 `vi` 作为后备。使用此标志可移除不需要或敏感的输出。
|
||||
|
||||
```sh
|
||||
termshot --edit -- "ls -a"
|
||||
```
|
||||
|
||||
### Miscellaneous flags
|
||||
### 其他标志
|
||||
|
||||
#### `--raw-write <file>`
|
||||
|
||||
Write command output as-is into the file that is specified as the flag argument. No screenshot is being created. The command-line flag `--filename` has no effect, when `--raw-write` is used.
|
||||
将命令输出原样写入标志参数指定的文件。不会生成截图。使用 `--raw-write` 时,命令行标志 `--filename` 无效。
|
||||
|
||||
#### `--raw-read <file>`
|
||||
|
||||
Read input from provided file instead of running a command. If this flag is being used, no pseudo terminal is being created to execute a command. The command-line flags `--show-cmd`, and `--edit` have no effect, when `--raw-read` is used.
|
||||
从提供的文件读取输入,而不是运行命令。使用此标志时,不会创建伪终端来执行命令。使用 `--raw-read` 时,命令行标志 `--show-cmd` 和 `--edit` 无效。
|
||||
|
||||
#### `--version`/`-v`
|
||||
|
||||
Print the version of `termshot` installed.
|
||||
打印已安装的 `termshot` 版本。
|
||||
|
||||
```sh
|
||||
$ termshot --version
|
||||
termshot version 0.2.5
|
||||
```
|
||||
|
||||
### Multiple commands
|
||||
### 多条命令
|
||||
|
||||
In order to work, `termshot` uses a pseudo terminal for the command to be executed. For advanced use cases, you can invoke a fully interactive shell, run several commands, and capture the entire output. The screenshot will be created once you terminate the shell.
|
||||
为了正常工作,`termshot` 会使用伪终端来执行命令。对于高级用法,你可以启动完全交互式的 shell,运行多条命令,并捕获全部输出。退出 shell 后将创建截图。
|
||||
|
||||
```sh
|
||||
termshot /bin/zsh
|
||||
```
|
||||
|
||||
> _Please note:_ This project is work in progress. Although a lot of the ANSI sequences can be parsed, there are definitely commands in existence that create output that cannot be parsed correctly, yet. Also, commands that reset the cursor position are known to create issues.
|
||||
> _请注意:_ 本项目仍在开发中。虽然许多 ANSI 序列可以被解析,但确实存在一些命令产生的输出尚无法被正确解析。此外,已知会重置光标位置的命令也会引发问题。
|
||||
|
||||
Reference in New Issue
Block a user