Skip to content

Commit 3a7c5eb

Browse files
committed
Merge branch 'release/0.1.0'
2 parents 497bbf3 + 291c48b commit 3a7c5eb

File tree

7 files changed

+81
-2365
lines changed

7 files changed

+81
-2365
lines changed

.github/workflows/rust-ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Rust CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main", "develop" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
checks:
14+
name: Rust Checks
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install Rust toolchain
21+
uses: dtolnay/rust-toolchain@stable
22+
with:
23+
toolchain: stable
24+
components: rustfmt, clippy
25+
26+
- name: Cache cargo registry
27+
uses: actions/cache@v3
28+
with:
29+
path: |
30+
~/.cargo/registry
31+
~/.cargo/git
32+
target
33+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
34+
35+
- name: Run cargo fmt
36+
run: cargo fmt --all -- --check
37+
38+
- name: Run cargo clippy
39+
run: cargo clippy --all-targets --all-features -- -D warnings
40+
41+
- name: Run cargo test
42+
run: cargo test --all-features --release

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ version = "0.1.0"
44
edition = "2021"
55
authors = ["Gavin Zheng<gav.zheng@outlook.com"]
66
description = "A Swiss Army Knife for Developers.🌳"
7+
keywords = ["wutong", "cli", "developer"]
8+
homepage = "https://github.com/WutongDev/wutong"
9+
documentation = "https://github.com/GavZheng/wutong/blob/main/README.md"
710
repository = "https://github.com/WutongDev/wutong"
811
license = "MIT"
912
readme = "README.md"
1013

1114
[dependencies]
1215
clap = "4.5.26"
16+
colored = "3.0.0"
1317
md5 = "0.7.0"

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ In our daily project development, we frequently encounter situations where we ne
2424
---
2525

2626
## How to Install Wutong
27-
> [!NOTE]
28-
> During the test phase, Wutong does not provide installation methods. If you wish to experience it, please compile it yourself. Upon the release of the official version, Wutong will provide installation methods.
29-
> Version 0.1.0 we will launch Wutong at HomeBrew
27+
If you are a MacOS user, you can use:
28+
```bash
29+
brew install wutong
30+
```
31+
If you are a Windows or Linux user, please wait for the subsequent version.
32+
P.S.: Of course, you can compile Wutong yourself.
3033

3134
---
3235

media/wutong_logo.jpg

-165 KB
Binary file not shown.

media/wutong_logo.svg

Lines changed: 0 additions & 2344 deletions
This file was deleted.

src/main.rs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ mod color;
55
mod md5;
66

77
use clap::{Arg, ArgGroup, Command};
8+
use colored::*;
89

910
fn main() {
1011
let matches = Command::new("Wutong")
11-
.version("0.1.0-alpha")
12+
.version("0.1.0")
1213
.about("Wutong - A Swiss Army Knife of Developers.🌳")
1314
.author("Gavin Zheng<gav.zheng@outlook.com>")
1415
.subcommand(
@@ -96,8 +97,8 @@ fn main() {
9697
input, converted[0], converted[1], converted[2]
9798
);
9899
}
99-
Err(e) => {
100-
eprintln!("Error converting binary: {}", e);
100+
Err(error) => {
101+
eprintln!("{}: {}", "Error converting binary".red(), error);
101102
std::process::exit(1);
102103
}
103104
}
@@ -113,8 +114,8 @@ fn main() {
113114
converted[0], input, converted[1], converted[2]
114115
);
115116
}
116-
Err(e) => {
117-
eprintln!("Error converting octal: {}", e);
117+
Err(error) => {
118+
eprintln!("{}: {}", "Error converting octal".red(), error);
118119
std::process::exit(1);
119120
}
120121
}
@@ -130,8 +131,8 @@ fn main() {
130131
converted[0], converted[1], input, converted[2]
131132
);
132133
}
133-
Err(e) => {
134-
eprintln!("Error converting decimal: {}", e);
134+
Err(error) => {
135+
eprintln!("{}: {}", "Error converting decimal".red(), error);
135136
std::process::exit(1);
136137
}
137138
}
@@ -147,8 +148,8 @@ fn main() {
147148
converted[0], converted[1], converted[2], input
148149
);
149150
}
150-
Err(e) => {
151-
eprintln!("Error converting hexadecimal: {}", e);
151+
Err(error) => {
152+
eprintln!("{}: {}", "Error converting hexadecimal".red(), error);
152153
std::process::exit(1);
153154
}
154155
}
@@ -162,8 +163,8 @@ fn main() {
162163

163164
match result {
164165
Ok(converted) => println!("Base16: {}\nBase64: {}", converted[0], converted[1]),
165-
Err(e) => {
166-
eprintln!("Error encoding: {}", e);
166+
Err(error) => {
167+
eprintln!("{}: {}", "Error encoding".red(), error);
167168
std::process::exit(1);
168169
}
169170
}
@@ -176,20 +177,20 @@ fn main() {
176177
println!("Base16: {}\nBase64: {}", converted_base16, converted_base64);
177178
}
178179
[Err(error), Ok(converted)] => {
179-
eprintln!("Base16 decode error: {}", error);
180+
eprintln!("{} {}", "Base16 decode error:".red(), error);
180181
println!("Base64: {}", converted);
181182
}
182183
[Ok(converted), Err(error)] => {
183184
println!("Base16: {}", converted);
184-
eprintln!("Base64 decode error: {}", error);
185+
eprintln!("{}: {}", "Base64 decode error".red(), error);
185186
}
186187
[Err(error_base16), Err(error_base64)] => {
187-
eprintln!("Base16 decode error: {}", error_base16);
188-
eprintln!("Base64 decode error: {}", error_base64);
188+
eprintln!("{} {}", "Base16 decode error:".red(), error_base16);
189+
eprintln!("{} {}", "Base64 decode error:".red(), error_base64);
189190
}
190191
}
191192
}
192-
_ => panic!("Invalid base conversion option"),
193+
_ => panic!("{}", "Error: Invalid base conversion option".red()),
193194
},
194195
Some(("md5", subcommand_md5)) => {
195196
let result = md5::text::md5_text(subcommand_md5.get_one::<String>("text").unwrap());
@@ -201,7 +202,7 @@ fn main() {
201202
);
202203
match result {
203204
Ok(result) => println!("ASCII: {}\nUnicode: {}", result[0], result[1]),
204-
Err(error) => println!("{}", error),
205+
Err(error) => println!("{} {}", "Error:".red(), error),
205206
}
206207
}
207208
Some(("color", subcommand_color)) => {
@@ -210,7 +211,7 @@ fn main() {
210211
);
211212
match result {
212213
Ok(result) => println!("RGB: {}\nHex: {}", result.0, result.1),
213-
Err(error) => println!("{}", error),
214+
Err(error) => println!("{} {}", "Error:".red(), error),
214215
}
215216
}
216217
_ => {}

0 commit comments

Comments
 (0)