Skip to content

Commit

Permalink
1. Remove the blocking feature of reqwest
Browse files Browse the repository at this point in the history
2. Optimization package show
  • Loading branch information
BeichenY1 committed Jan 15, 2024
1 parent 6c4f244 commit ea4554e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
9 changes: 0 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ clap = { version = "4.4.11", features = ["derive"] }
directories = "5.0.1"
serde = { version = "1.0.190", features = ["derive"] }
dialoguer = "0.11.0"
reqwest = { version = "0.11", features = ["blocking", "json"] }
reqwest = { version = "0.11", features = ["json"] }
bytes = "1.5.0"
tokio = { version = "1", features = ["full"] }
lazy_static = "1.4.0"
13 changes: 7 additions & 6 deletions src/packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl fmt::Display for PackageType {
struct PackageInfo {
typ: PackageType,
name: String,
branch: String,
version: String,
description: String
}
Expand Down Expand Up @@ -100,14 +101,14 @@ pub async fn list_packages() -> Result<(), Box<dyn Error>> {
let pkgs = load_or_refresh_packages(true).await?;

// print the information of each package
println!("{:-<1$}", "", 87);
println!("{:<10} {:<30} {:<22} {:<25}", "TYPE".bold(), "NAME".bold(), "VERSION".bold(), "DESCRIPTION".bold());
println!("{:-<1$}", "", 87);
println!("{:-<1$}", "", 97);
println!("{:<10} {:<30} {:<10} {:<22} {:<25}", "TYPE".bold(), "NAME".bold(), "BRANCH".bold(), "VERSION".bold(), "DESCRIPTION".bold());
println!("{:-<1$}", "", 97);
for pkg in pkgs {
println!("{:<10} {:<30} {:<22} {:<25}",
pkg.typ, pkg.name, pkg.version, pkg.description);
println!("{:<10} {:<30} {:<10} {:<22} {:<25}",
pkg.typ, pkg.name, pkg.branch, pkg.version, pkg.description);
}
println!("{:-<1$}", "", 87);
println!("{:-<1$}", "", 97);

Ok(())
}
Expand Down

0 comments on commit ea4554e

Please sign in to comment.