Skip to content

Commit e81f2ce

Browse files
committed
Merge branch 'release/v0.2.0'
2 parents 3a7c5eb + dc594e2 commit e81f2ce

File tree

11 files changed

+479
-25
lines changed

11 files changed

+479
-25
lines changed

Cargo.lock

Lines changed: 110 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wutong"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55
authors = ["Gavin Zheng<gav.zheng@outlook.com"]
66
description = "A Swiss Army Knife for Developers.🌳"
@@ -12,6 +12,9 @@ license = "MIT"
1212
readme = "README.md"
1313

1414
[dependencies]
15-
clap = "4.5.26"
15+
clap = "4.5.34"
1616
colored = "3.0.0"
1717
md5 = "0.7.0"
18+
19+
[dev-dependencies]
20+
tempfile = "3.19.1"

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<h1 style="text-align: center;">Wutong - The Swiss Army Knife for Developers</h1>
22

3+
[![Author: Gavin Zheng](https://img.shields.io/badge/Author-Gavin_Zheng-f2f28d)](https://github.com/GavZheng)
4+
![Language: Rust](https://img.shields.io/badge/Language-Rust-orange)
5+
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-blue)
6+
![License: MIT](https://img.shields.io/badge/License-MIT-green)
7+
![Github Stars](https://img.shields.io/github/stars/WutongDev/wutong?style=flat&color=red)
8+
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT_zh.md)
9+
310
[English](./README.md) | [简体中文](./docs/zh/README_zh.md)
411

512
---
@@ -24,18 +31,20 @@ In our daily project development, we frequently encounter situations where we ne
2431
---
2532

2633
## How to Install Wutong
27-
If you are a MacOS user, you can use:
34+
If you are a macOS user, you can use:
2835
```bash
36+
brew tap GavZheng/wutong
2937
brew install wutong
3038
```
39+
PS: Only macOS 13 or later is supported.
3140
If you are a Windows or Linux user, please wait for the subsequent version.
32-
P.S.: Of course, you can compile Wutong yourself.
41+
*Of course, you can compile Wutong yourself.*
3342

3443
---
3544

3645
## How to Use Wutong
3746
You can obtain detailed information by typing `wutong --help` in the command line.
38-
The general functions of Wutong are listed below (v0.1.0-beta):
47+
The general functions of Wutong are listed below (v0.2.0):
3948

4049
| Function | Description |
4150
|----------|--------------------------------------------------------------|
@@ -44,6 +53,7 @@ The general functions of Wutong are listed below (v0.1.0-beta):
4453
| color | Convert between RGB and Hex colors |
4554
| md5 | Hash input strings using MD5 |
4655
| charcode | Convert string encodings |
56+
| flow | Manage git repositories according to the Gitflow workflow |
4757

4858
---
4959

@@ -71,5 +81,21 @@ We sincerely thank the following individuals who have made outstanding contribut
7181

7282
---
7383

84+
FAQ
85+
86+
Q1: Why is it named "Wutong"?
87+
A: The name originates from developer Gavin's friend, Silent, whose favorite tree species is the Chinese parasol tree (梧桐). "Wutong" is the Pinyin transliteration of the tree's Chinese name.
88+
89+
Q2: Why was Rust chosen as the development language?
90+
A: Rust was selected as the optimal technical choice after evaluating languages like Python, C++, and C, due to its cross-platform capabilities, memory safety features, and high-performance execution that align with the project's requirements.
91+
92+
Q3: Why is only macOS currently supported?
93+
A: Current development prioritizes core feature refinement and rapid iteration. Windows and Linux versions are on the roadmap, with multi-platform adaptation scheduled to commence once core functionalities are stabilized.
94+
95+
Q4: Where can I learn more about Gavin?
96+
A: Visit [Gavin's GitHub profile](https://github.com/GavZheng) to explore his technical contributions and open-source projects.
97+
98+
---
99+
74100
## License
75101
[MIT](./LICENSE) © 2025 Gavin Zheng

docs/zh/README_zh.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<h1 style="text-align: center;">梧桐 - 开发者的瑞士军刀</h1>
22

3+
[![Author: Gavin Zheng](https://img.shields.io/badge/Author-Gavin_Zheng-f2f28d)](https://github.com/GavZheng)
4+
![Language: Rust](https://img.shields.io/badge/Language-Rust-orange)
5+
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-blue)
6+
![License: MIT](https://img.shields.io/badge/License-MIT-green)
7+
![Github Stars](https://img.shields.io/github/stars/WutongDev/wutong?style=flat&color=red)
8+
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT_zh.md)
9+
310
[English](../../README.md) | [简体中文](README_zh.md)
411

512
梧桐是一个由**Rust**编写的跨平台工具箱,用于帮助开发者快速完成各种任务。
613

7-
![LICENSE](https://img.shields.io/badge/License-MIT-blue)
8-
![Language](https://img.shields.io/badge/Language-Rust-orange)
9-
![Version](https://img.shields.io/badge/Version-v0.1.0%20alpha-green)
10-
![Github Stars](https://img.shields.io/github/stars/WutongDev/wutong?style=flat&color=red)
11-
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT_zh.md)
12-
1314
---
1415

1516
## 目录
@@ -32,14 +33,19 @@
3233
---
3334

3435
## 如何安装梧桐
35-
> [!NOTE]
36-
> 梧桐在测试阶段不提供安装方式,如希望体验请自行编译。在正式版发布后,梧桐将会提供安装方式。
37-
36+
如果您是 macOS 用户,则可以使用:
37+
```bash
38+
brew tap GavZheng/wutong
39+
brew install wutong
40+
```
41+
PS:仅支持 macOS 13 或更高版本。
42+
如果您是 Windows 或 Linux 用户,请等待后续版本。
43+
*当然,您可以自己编译梧桐。*
3844
---
3945

4046
## 如何使用梧桐
4147
你可以通过在命令行键入`wutong --help`来获取详细信息。
42-
梧桐的大致功能如下表(v0.1.0-alpha
48+
梧桐的大致功能如下表(v0.2.0
4349

4450
| 功能 | 描述 |
4551
|----------|----------------------------|
@@ -48,6 +54,7 @@
4854
| color | RGB和Hex颜色的相互转换 |
4955
| md5 | 将输入的字符串进行md5哈希 |
5056
| charcode | 字符串编码转换 |
57+
| flow | 根据 Gitflow 工作流程管理 git 存储库 |
5158

5259
---
5360

@@ -73,5 +80,20 @@
7380

7481
---
7582

83+
## FAQ
84+
Q1: 为什么叫梧桐?
85+
A:这个名字来自我(Gavin)的一个朋友(Silent),梧桐是她最喜欢的树。“Wutong”是梧桐的拼音。
86+
87+
Q2: 为何选择Rust作为开发语言?
88+
A: Rust凭借其卓越的跨平台能力、内存安全特性和高效执行性能,在综合评估Python/C++/C等候选语言后,被确认为满足项目需求的最佳技术选型。
89+
90+
Q3: 当前为何仅支持macOS平台?
91+
A: 现阶段开发重心聚焦于核心功能完善与快速迭代。Windows/Linux版本已列入roadmap,将在主体功能稳定后启动多平台适配工作。
92+
93+
Q4:更多关于Gavin?
94+
A:你可以访问[Gavin的Github主页](https://github.com/GavZheng)
95+
96+
---
97+
7698
## 许可证
7799
[MIT](../../LICENSE) © 2025 Gavin Zheng

src/base/text/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn base16_encode(input: &str) -> Result<String, FromUtf8Error> {
1717
pub fn base64_encode(input: &str) -> Result<String, FromUtf8Error> {
1818
const BASE64_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1919
let bytes = input.as_bytes();
20-
let mut result = Vec::with_capacity(((bytes.len() + 2) / 3) * 4);
20+
let mut result = Vec::with_capacity(bytes.len().div_ceil(3) * 4);
2121
let mut buffer = [0u8; 3];
2222
let mut buffer_index = 0;
2323

src/flow/branch.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use crate::BranchType;
2+
use std::process;
3+
4+
pub fn branch(branch_type: BranchType, branch_name: &str) -> Result<(), String> {
5+
let git_path = crate::flow::git::which_git().map_err(|e| e.to_string())?;
6+
7+
let prefix = match branch_type {
8+
BranchType::Feature => "feature",
9+
BranchType::Release => "release",
10+
BranchType::Hotfix => "hotfix",
11+
};
12+
13+
let branch = format!("{}/{}", prefix, branch_name);
14+
15+
let output = process::Command::new(&git_path)
16+
.arg("checkout")
17+
.arg("-b")
18+
.arg(&branch)
19+
.output()
20+
.map_err(|e| format!("Failed to execute Git command: {}", e))?;
21+
22+
if !output.status.success() {
23+
let error_msg = String::from_utf8_lossy(&output.stderr);
24+
return Err(format!(
25+
"Failed to create branch '{}': {}",
26+
branch, error_msg
27+
));
28+
}
29+
30+
Ok(())
31+
}

0 commit comments

Comments
 (0)