style: format Cub CLI code
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -188,10 +188,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_command(
|
||||
context: &AppContext,
|
||||
command: Commands,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn run_command(context: &AppContext, command: Commands) -> Result<(), Box<dyn std::error::Error>> {
|
||||
match command {
|
||||
Commands::Install { package } => install_package(context, &package)?,
|
||||
Commands::Search { query } => search_packages(context, &query)?,
|
||||
@@ -574,7 +571,10 @@ fn get_aur_recipe(package: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let store = init_cub_store()?;
|
||||
let recipe_path = cub::recipe::save_recipe_to_store(&conversion.rbpkg, &store)?;
|
||||
let recipe_dir = recipe_path.parent().ok_or_else(|| {
|
||||
CubError::BuildFailed(format!("invalid saved recipe path {}", recipe_path.display()))
|
||||
CubError::BuildFailed(format!(
|
||||
"invalid saved recipe path {}",
|
||||
recipe_path.display()
|
||||
))
|
||||
})?;
|
||||
|
||||
fs::create_dir_all(recipe_dir.join("patches"))?;
|
||||
@@ -694,10 +694,7 @@ fn query_local_packages(context: &AppContext) -> Result<(), Box<dyn std::error::
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn query_local_info(
|
||||
context: &AppContext,
|
||||
package: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn query_local_info(context: &AppContext, package: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut library = context.open_library()?;
|
||||
let info = library.info(PackageName::new(package.to_string())?)?;
|
||||
print_local_package_info(package, &info);
|
||||
@@ -720,14 +717,20 @@ fn query_local_files(
|
||||
|
||||
let package_state = PackageState::from_sysroot(&context.install_path)?;
|
||||
let install_state = package_state.installed.get(&package_name).ok_or_else(|| {
|
||||
CubError::PackageNotFound(format!("{package} is not installed under {}", context.install_path.display()))
|
||||
})?;
|
||||
let repo_key = package_state.pubkeys.get(&install_state.remote).ok_or_else(|| {
|
||||
CubError::BuildFailed(format!(
|
||||
"missing repository public key '{}' for installed package {}",
|
||||
install_state.remote, package
|
||||
CubError::PackageNotFound(format!(
|
||||
"{package} is not installed under {}",
|
||||
context.install_path.display()
|
||||
))
|
||||
})?;
|
||||
let repo_key = package_state
|
||||
.pubkeys
|
||||
.get(&install_state.remote)
|
||||
.ok_or_else(|| {
|
||||
CubError::BuildFailed(format!(
|
||||
"missing repository public key '{}' for installed package {}",
|
||||
install_state.remote, package
|
||||
))
|
||||
})?;
|
||||
|
||||
let head_path = context
|
||||
.install_path
|
||||
@@ -805,11 +808,23 @@ fn print_aur_package(package: &AurPackage) {
|
||||
fn print_local_package_info(package: &str, info: &pkg::PackageInfo) {
|
||||
println!("Repository : {}", info.package.remote);
|
||||
println!("Name : {}", info.package.package.name);
|
||||
println!("Version : {}", empty_if_blank(&info.package.package.version));
|
||||
println!("Target : {}", empty_if_blank(&info.package.package.target));
|
||||
println!(
|
||||
"Version : {}",
|
||||
empty_if_blank(&info.package.package.version)
|
||||
);
|
||||
println!(
|
||||
"Target : {}",
|
||||
empty_if_blank(&info.package.package.target)
|
||||
);
|
||||
println!("Installed : {}", yes_no(info.installed));
|
||||
println!("Depends On : {}", join_package_names(&info.package.package.depends));
|
||||
println!("Blake3 : {}", empty_if_blank(&info.package.package.blake3));
|
||||
println!(
|
||||
"Depends On : {}",
|
||||
join_package_names(&info.package.package.depends)
|
||||
);
|
||||
println!(
|
||||
"Blake3 : {}",
|
||||
empty_if_blank(&info.package.package.blake3)
|
||||
);
|
||||
println!("Storage Size : {}", info.package.package.storage_size);
|
||||
println!("Network Size : {}", info.package.package.network_size);
|
||||
println!(
|
||||
|
||||
Reference in New Issue
Block a user