Skip to content

Commit 4e6f0b4

Browse files
committed
feat: v0.1.6
1 parent b9b643a commit 4e6f0b4

File tree

8 files changed

+18
-24
lines changed

8 files changed

+18
-24
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hyperlane-cli"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
readme = "README.md"
55
edition = "2024"
66
authors = ["root@ltpp.vip"]

src/config/fn.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ pub(crate) fn parse_args() -> Args {
4747
if command == CommandType::Help || command == CommandType::Version {
4848
command = CommandType::New;
4949
i += 1;
50-
if i < raw_args.len() && !raw_args[i].starts_with("--") && !raw_args[i].starts_with("-") {
50+
if i < raw_args.len()
51+
&& !raw_args[i].starts_with("--")
52+
&& !raw_args[i].starts_with("-")
53+
{
5154
project_name = Some(raw_args[i].clone());
5255
} else {
5356
i -= 1;

src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ async fn main() {
8888
exit(1);
8989
}
9090
} else {
91-
eprintln!("Error: Project name is required. Usage: hyperlane-cli new <PROJECT_NAME>");
91+
eprintln!(
92+
"Error: Project name is required. Usage: hyperlane-cli new <PROJECT_NAME>"
93+
);
9294
exit(1);
9395
}
9496
}

src/new/fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ async fn git_clone(config: &NewProjectConfig) -> Result<(), NewError> {
7070
.stderr(Stdio::piped())
7171
.output()
7272
.await
73-
.map_err(|e| NewError::IoError(e))?;
73+
.map_err(NewError::IoError)?;
7474
if output.status.success() {
7575
Ok(())
7676
} else {

src/publish/enum.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
/// Error types for publish operation
2-
#[derive(Clone, Debug, Eq, PartialEq)]
2+
#[derive(Debug, thiserror::Error)]
33
pub(crate) enum PublishError {
44
/// Failed to parse Cargo.toml
5+
#[error("Failed to parse Cargo.toml")]
56
ManifestParseError,
67
/// Circular dependency detected
8+
#[error("Circular dependency detected")]
79
CircularDependency,
810
/// IO error
9-
IoError,
11+
#[error("IO error: {0}")]
12+
IoError(#[from] std::io::Error),
1013
}

src/publish/fn.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::*;
1010
///
1111
/// - `Result<Vec<Package>, PublishError>`: List of packages or error
1212
fn discover_packages(workspace_root: &Path) -> Result<Vec<Package>, PublishError> {
13-
let content: String = read_to_string(workspace_root).map_err(|_| PublishError::IoError)?;
13+
let content: String = read_to_string(workspace_root)?;
1414
let doc: toml::Value =
1515
toml::from_str(&content).map_err(|_| PublishError::ManifestParseError)?;
1616
let mut packages: Vec<Package> = Vec::new();
@@ -51,8 +51,8 @@ fn expand_pattern(
5151
let parent: &Path = Path::new(pattern).parent().unwrap_or(Path::new("."));
5252
let full_parent: PathBuf = base_path.join(parent);
5353
if full_parent.is_dir() {
54-
for entry in std::fs::read_dir(&full_parent).map_err(|_| PublishError::IoError)? {
55-
let entry: std::fs::DirEntry = entry.map_err(|_| PublishError::IoError)?;
54+
for entry in std::fs::read_dir(&full_parent)? {
55+
let entry: std::fs::DirEntry = entry?;
5656
let path: PathBuf = entry.path();
5757
if path.is_dir() {
5858
let cargo_toml: PathBuf = path.join("Cargo.toml");
@@ -96,7 +96,7 @@ fn read_single_package(manifest_path: &Path) -> Result<Package, PublishError> {
9696
///
9797
/// - `Result<Package, PublishError>`: Package info or error
9898
fn read_package_manifest(manifest_path: &Path) -> Result<Package, PublishError> {
99-
let content: String = read_to_string(manifest_path).map_err(|_| PublishError::IoError)?;
99+
let content: String = read_to_string(manifest_path)?;
100100
let doc: toml::Value =
101101
toml::from_str(&content).map_err(|_| PublishError::ManifestParseError)?;
102102
let package_table: &toml::Value = doc.get("package").ok_or(PublishError::ManifestParseError)?;

src/publish/impl.rs

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

src/publish/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
mod r#enum;
22
mod r#fn;
3-
mod r#impl;
43
mod r#struct;
54

65
pub(crate) use {r#enum::*, r#fn::*, r#struct::*};

0 commit comments

Comments
 (0)