Skip to content

Commit a39fe16

Browse files
committed
update docs
1 parent eeef530 commit a39fe16

File tree

2 files changed

+2
-272
lines changed

2 files changed

+2
-272
lines changed

docs/posts/xmake-update-v3.0.5.md

Lines changed: 1 addition & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -513,122 +513,7 @@ For more details, see: [#6993](https://github.com/xmake-io/xmake/pull/6993)
513513

514514
### Improve TTY handling and output
515515

516-
We have improved TTY handling and output formatting, providing better terminal compatibility and visual feedback. The `core.base.tty` module now offers comprehensive cursor control and screen management capabilities for creating rich terminal interfaces.
517-
518-
**Key features:**
519-
520-
- **Cursor movement**: Move cursor up, down, left, right, or to specific columns
521-
- **Line operations**: Clear lines, erase to end of line, move to start of line
522-
- **Cursor visibility**: Hide/show cursor for smoother animations
523-
- **Position management**: Save and restore cursor positions
524-
- **ANSI detection**: Check if terminal supports ANSI control codes
525-
526-
**Basic usage:**
527-
528-
```lua
529-
import("core.base.tty")
530-
531-
-- Check if ANSI is supported
532-
if tty.has_vtansi() then
533-
-- Simple progress bar
534-
for i = 0, 100, 5 do
535-
tty.cr() -- Move to start of line
536-
tty.erase_line() -- Clear the line
537-
io.write(string.format("Progress: %d%%", i))
538-
io.flush()
539-
os.sleep(50)
540-
end
541-
print("") -- New line after progress
542-
end
543-
```
544-
545-
**Update previous lines:**
546-
547-
```lua
548-
import("core.base.tty")
549-
550-
io.write("Building project...\n")
551-
io.write("Status: Starting...\n")
552-
io.flush()
553-
554-
os.sleep(1000)
555-
556-
-- Go back and update the status line
557-
tty.cursor_move_up(1)
558-
tty.cr()
559-
tty.erase_line()
560-
io.write("Status: Compiling files...\n")
561-
io.flush()
562-
```
563-
564-
**Multi-line updates:**
565-
566-
```lua
567-
import("core.base.tty")
568-
569-
-- Create a status board
570-
io.write("Task 1: Waiting...\n")
571-
io.write("Task 2: Waiting...\n")
572-
io.write("Task 3: Waiting...\n")
573-
io.flush()
574-
575-
tty.cursor_hide()
576-
577-
-- Update Task 1
578-
tty.cursor_move_up(3)
579-
tty.cr()
580-
tty.erase_line()
581-
io.write("Task 1: Running...\n")
582-
io.flush()
583-
584-
-- Update Task 2
585-
tty.cr()
586-
tty.erase_line()
587-
io.write("Task 2: Done ✓\n")
588-
io.flush()
589-
590-
tty.cursor_show()
591-
```
592-
593-
**Live dashboard example:**
594-
595-
```lua
596-
import("core.base.tty")
597-
598-
-- Create a build dashboard with multiple progress bars
599-
io.write("⏸ Parse project files [" .. string.rep("", 30) .. "] 0%\n")
600-
io.write("⏸ Compile sources [" .. string.rep("", 30) .. "] 0%\n")
601-
io.write("⏸ Link executable [" .. string.rep("", 30) .. "] 0%\n")
602-
io.flush()
603-
604-
tty.cursor_hide()
605-
606-
-- Update each task line independently
607-
for i = 1, 100 do
608-
tty.cursor_move_up(3)
609-
610-
-- Update Task 1
611-
local progress1 = i / 100
612-
local bar1 = string.rep("", math.floor(progress1 * 30)) .. string.rep("", 30 - math.floor(progress1 * 30))
613-
tty.cr()
614-
tty.erase_line()
615-
io.write(string.format("▶ Parse project files [%s] %3d%%\n", bar1, math.floor(progress1 * 100)))
616-
617-
-- Update Task 2 (starts later)
618-
local progress2 = math.max(0, (i - 20) / 80)
619-
local bar2 = string.rep("", math.floor(progress2 * 30)) .. string.rep("", 30 - math.floor(progress2 * 30))
620-
tty.cr()
621-
tty.erase_line()
622-
io.write(string.format("▶ Compile sources [%s] %3d%%\n", bar2, math.floor(progress2 * 100)))
623-
624-
io.flush()
625-
os.sleep(30)
626-
end
627-
628-
tty.cursor_show()
629-
```
630-
631-
**Available functions:**
516+
We have improved TTY handling and output formatting in the `core.base.tty` module. The following new interfaces have been added:
632517

633518
- `tty.cursor_move_up(n)` / `tty.cursor_move_down(n)` - Move cursor vertically
634519
- `tty.cursor_move_left(n)` / `tty.cursor_move_right(n)` - Move cursor horizontally
@@ -640,34 +525,14 @@ tty.cursor_show()
640525
- `tty.erase_line_to_end()` - Erase from cursor to end of line
641526
- `tty.has_vtansi()` - Check if terminal supports ANSI control codes
642527

643-
This enables creating rich terminal interfaces with progress bars, live dashboards, multi-line status updates, and smooth animations without clearing the entire screen.
644-
645528
For more details, see: [#6970](https://github.com/xmake-io/xmake/pull/6970)
646529

647-
### Refactor Xcode toolchain integration
648-
649-
We have refactored the Xcode toolchain and integrated it into the LLVM toolchain for Apple devices, simplifying toolchain management for macOS and iOS development.
650-
651-
This change makes it easier to switch between different LLVM-based toolchains on Apple platforms.
652-
653-
For more details, see: [#6977](https://github.com/xmake-io/xmake/pull/6977)
654-
655530
### Add Ghostty terminal detection support
656531

657532
We have added support for detecting the Ghostty terminal, ensuring proper output formatting and color support in this modern terminal emulator.
658533

659534
For more details, see: [#6987](https://github.com/xmake-io/xmake/pull/6987)
660535

661-
### Add Ninja generator support
662-
663-
We have added Ninja generator support to the xmake.sh/configure script, allowing you to generate Ninja build files for faster builds.
664-
665-
```bash
666-
$ ./xmake.sh --generator=ninja
667-
```
668-
669-
For more details, see: [#7019](https://github.com/xmake-io/xmake/pull/7019)
670-
671536
### Improve graph module performance
672537

673538
We have improved the performance of the graph module, which is used for dependency resolution and build graph generation.

docs/zh/posts/xmake-update-v3.0.5.md

Lines changed: 1 addition & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -513,122 +513,7 @@ target("test")
513513

514514
### 改进 TTY 处理和输出
515515

516-
我们改进了 TTY 处理和输出格式化,提供更好的终端兼容性和视觉反馈。`core.base.tty` 模块现在提供了全面的光标控制和屏幕管理功能,用于创建丰富的终端界面。
517-
518-
**主要功能:**
519-
520-
- **光标移动**:向上、向下、向左、向右移动光标,或移动到指定列
521-
- **行操作**:清除行、清除到行尾、移动到行首
522-
- **光标可见性**:隐藏/显示光标以实现更流畅的动画
523-
- **位置管理**:保存和恢复光标位置
524-
- **ANSI 检测**:检查终端是否支持 ANSI 控制码
525-
526-
**基本用法:**
527-
528-
```lua
529-
import("core.base.tty")
530-
531-
-- 检查是否支持 ANSI
532-
if tty.has_vtansi() then
533-
-- 简单进度条
534-
for i = 0, 100, 5 do
535-
tty.cr() -- 移动到行首
536-
tty.erase_line() -- 清除行
537-
io.write(string.format("进度: %d%%", i))
538-
io.flush()
539-
os.sleep(50)
540-
end
541-
print("") -- 进度后换行
542-
end
543-
```
544-
545-
**更新上一行:**
546-
547-
```lua
548-
import("core.base.tty")
549-
550-
io.write("正在构建项目...\n")
551-
io.write("状态: 启动中...\n")
552-
io.flush()
553-
554-
os.sleep(1000)
555-
556-
-- 返回并更新状态行
557-
tty.cursor_move_up(1)
558-
tty.cr()
559-
tty.erase_line()
560-
io.write("状态: 编译文件中...\n")
561-
io.flush()
562-
```
563-
564-
**多行更新:**
565-
566-
```lua
567-
import("core.base.tty")
568-
569-
-- 创建状态面板
570-
io.write("任务 1: 等待中...\n")
571-
io.write("任务 2: 等待中...\n")
572-
io.write("任务 3: 等待中...\n")
573-
io.flush()
574-
575-
tty.cursor_hide()
576-
577-
-- 更新任务 1
578-
tty.cursor_move_up(3)
579-
tty.cr()
580-
tty.erase_line()
581-
io.write("任务 1: 运行中...\n")
582-
io.flush()
583-
584-
-- 更新任务 2
585-
tty.cr()
586-
tty.erase_line()
587-
io.write("任务 2: 完成 ✓\n")
588-
io.flush()
589-
590-
tty.cursor_show()
591-
```
592-
593-
**实时仪表板示例:**
594-
595-
```lua
596-
import("core.base.tty")
597-
598-
-- 创建包含多个进度条的构建仪表板
599-
io.write("⏸ 解析项目文件 [" .. string.rep("", 30) .. "] 0%\n")
600-
io.write("⏸ 编译源文件 [" .. string.rep("", 30) .. "] 0%\n")
601-
io.write("⏸ 链接可执行文件 [" .. string.rep("", 30) .. "] 0%\n")
602-
io.flush()
603-
604-
tty.cursor_hide()
605-
606-
-- 独立更新每个任务行
607-
for i = 1, 100 do
608-
tty.cursor_move_up(3)
609-
610-
-- 更新任务 1
611-
local progress1 = i / 100
612-
local bar1 = string.rep("", math.floor(progress1 * 30)) .. string.rep("", 30 - math.floor(progress1 * 30))
613-
tty.cr()
614-
tty.erase_line()
615-
io.write(string.format("▶ 解析项目文件 [%s] %3d%%\n", bar1, math.floor(progress1 * 100)))
616-
617-
-- 更新任务 2(稍后开始)
618-
local progress2 = math.max(0, (i - 20) / 80)
619-
local bar2 = string.rep("", math.floor(progress2 * 30)) .. string.rep("", 30 - math.floor(progress2 * 30))
620-
tty.cr()
621-
tty.erase_line()
622-
io.write(string.format("▶ 编译源文件 [%s] %3d%%\n", bar2, math.floor(progress2 * 100)))
623-
624-
io.flush()
625-
os.sleep(30)
626-
end
627-
628-
tty.cursor_show()
629-
```
630-
631-
**可用函数:**
516+
我们改进了 `core.base.tty` 模块的 TTY 处理和输出格式。新增了以下接口:
632517

633518
- `tty.cursor_move_up(n)` / `tty.cursor_move_down(n)` - 垂直移动光标
634519
- `tty.cursor_move_left(n)` / `tty.cursor_move_right(n)` - 水平移动光标
@@ -640,34 +525,14 @@ tty.cursor_show()
640525
- `tty.erase_line_to_end()` - 清除从光标到行尾
641526
- `tty.has_vtansi()` - 检查终端是否支持 ANSI 控制码
642527

643-
这使得能够创建丰富的终端界面,包括进度条、实时仪表板、多行状态更新和流畅的动画,而无需清除整个屏幕。
644-
645528
更多详情,请参考:[#6970](https://github.com/xmake-io/xmake/pull/6970)
646529

647-
### 重构 Xcode 工具链集成
648-
649-
我们重构了 Xcode 工具链,并将其集成到 Apple 设备的 LLVM 工具链中,简化了 macOS 和 iOS 开发的工具链管理。
650-
651-
这个改动使得在 Apple 平台上切换不同的基于 LLVM 的工具链变得更加容易。
652-
653-
更多详情,请参考:[#6977](https://github.com/xmake-io/xmake/pull/6977)
654-
655530
### 添加 Ghostty 终端检测支持
656531

657532
我们添加了对 Ghostty 终端的检测支持,确保在这个现代终端模拟器中具有正确的输出格式和颜色支持。
658533

659534
更多详情,请参考:[#6987](https://github.com/xmake-io/xmake/pull/6987)
660535

661-
### 添加 Ninja 生成器支持
662-
663-
我们为 xmake.sh/configure 脚本添加了 Ninja 生成器支持,允许您生成 Ninja 构建文件以获得更快的构建速度。
664-
665-
```bash
666-
$ ./xmake.sh --generator=ninja
667-
```
668-
669-
更多详情,请参考:[#7019](https://github.com/xmake-io/xmake/pull/7019)
670-
671536
### 改进图模块性能
672537

673538
我们改进了图模块的性能,该模块用于依赖解析和构建图生成。

0 commit comments

Comments
 (0)