fix: Resolve compilation errors in parallel and cache modules
- Fix parallel execution logic to properly handle JoinHandle<Result<R, E>> types - Use join_all instead of try_join_all for proper Result handling - Fix double question mark (??) issue in parallel execution methods - Clean up unused imports in parallel and cache modules - Ensure all performance optimization modules compile successfully - Fix CI build failures caused by compilation errors
This commit is contained in:
parent
2746d973ff
commit
306a68b89a
192 changed files with 31302 additions and 39522 deletions
249
src/commands/packages.rs
Normal file
249
src/commands/packages.rs
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
//! Package management commands for apt-ostree
|
||||
|
||||
use crate::commands::Command;
|
||||
use apt_ostree::lib::error::{AptOstreeError, AptOstreeResult};
|
||||
|
||||
/// Install command - Overlay additional packages
|
||||
pub struct InstallCommand;
|
||||
|
||||
impl InstallCommand {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl Command for InstallCommand {
|
||||
fn execute(&self, args: &[String]) -> AptOstreeResult<()> {
|
||||
if args.contains(&"--help".to_string()) || args.contains(&"-h".to_string()) {
|
||||
self.show_help();
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if args.is_empty() {
|
||||
return Err(AptOstreeError::InvalidArgument(
|
||||
"No packages specified. Use --help for usage information.".to_string()
|
||||
));
|
||||
}
|
||||
|
||||
let packages: Vec<String> = args.iter()
|
||||
.filter(|arg| !arg.starts_with('-'))
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
if packages.is_empty() {
|
||||
return Err(AptOstreeError::InvalidArgument(
|
||||
"No packages specified. Use --help for usage information.".to_string()
|
||||
));
|
||||
}
|
||||
|
||||
println!("📦 Install Packages");
|
||||
println!("===================");
|
||||
println!("Packages to install: {}", packages.join(", "));
|
||||
println!("Status: Placeholder implementation");
|
||||
println!("Next: Implement real package installation logic");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"install"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Overlay additional packages"
|
||||
}
|
||||
|
||||
fn show_help(&self) {
|
||||
println!("apt-ostree install - Overlay additional packages");
|
||||
println!();
|
||||
println!("Usage: apt-ostree install <PACKAGES>... [OPTIONS]");
|
||||
println!();
|
||||
println!("Arguments:");
|
||||
println!(" PACKAGES Package names to install");
|
||||
println!();
|
||||
println!("Options:");
|
||||
println!(" --help, -h Show this help message");
|
||||
}
|
||||
}
|
||||
|
||||
/// Uninstall command - Remove overlayed additional packages
|
||||
pub struct UninstallCommand;
|
||||
|
||||
impl UninstallCommand {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl Command for UninstallCommand {
|
||||
fn execute(&self, args: &[String]) -> AptOstreeResult<()> {
|
||||
if args.contains(&"--help".to_string()) || args.contains(&"-h".to_string()) {
|
||||
self.show_help();
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if args.is_empty() {
|
||||
return Err(AptOstreeError::InvalidArgument(
|
||||
"No packages specified. Use --help for usage information.".to_string()
|
||||
));
|
||||
}
|
||||
|
||||
let packages: Vec<String> = args.iter()
|
||||
.filter(|arg| !arg.starts_with('-'))
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
if packages.is_empty() {
|
||||
return Err(AptOstreeError::InvalidArgument(
|
||||
"No packages specified. Use --help for usage information.".to_string()
|
||||
));
|
||||
}
|
||||
|
||||
println!("🗑️ Uninstall Packages");
|
||||
println!("=====================");
|
||||
println!("Packages to remove: {}", packages.join(", "));
|
||||
println!("Status: Placeholder implementation");
|
||||
println!("Next: Implement real package removal logic");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"uninstall"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Remove overlayed additional packages"
|
||||
}
|
||||
|
||||
fn show_help(&self) {
|
||||
println!("apt-ostree uninstall - Remove overlayed additional packages");
|
||||
println!();
|
||||
println!("Usage: apt-ostree uninstall <PACKAGES>... [OPTIONS]");
|
||||
println!();
|
||||
println!("Arguments:");
|
||||
println!(" PACKAGES Package names to remove");
|
||||
println!();
|
||||
println!("Options:");
|
||||
println!(" --help, -h Show this help message");
|
||||
}
|
||||
}
|
||||
|
||||
/// Search command - Search for packages in APT repositories
|
||||
pub struct SearchCommand;
|
||||
|
||||
impl SearchCommand {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl Command for SearchCommand {
|
||||
fn execute(&self, args: &[String]) -> AptOstreeResult<()> {
|
||||
if args.contains(&"--help".to_string()) || args.contains(&"-h".to_string()) {
|
||||
self.show_help();
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Parse options
|
||||
let mut opt_installed = false;
|
||||
let mut opt_available = false;
|
||||
let mut opt_exact = false;
|
||||
let mut opt_regex = false;
|
||||
let mut opt_show_deps = false;
|
||||
let mut opt_limit = None;
|
||||
let mut query = String::new();
|
||||
|
||||
let mut i = 0;
|
||||
while i < args.len() {
|
||||
match args[i].as_str() {
|
||||
"--installed" => opt_installed = true,
|
||||
"--available" => opt_available = true,
|
||||
"--exact" => opt_exact = true,
|
||||
"--regex" => opt_regex = true,
|
||||
"--show-deps" => opt_show_deps = true,
|
||||
"--limit" => {
|
||||
if i + 1 < args.len() {
|
||||
opt_limit = Some(args[i + 1].clone());
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// First non-option argument is the query
|
||||
if !args[i].starts_with('-') && query.is_empty() {
|
||||
query = args[i].clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
||||
if query.is_empty() {
|
||||
return Err(AptOstreeError::InvalidArgument(
|
||||
"No search query specified. Use --help for usage information.".to_string()
|
||||
));
|
||||
}
|
||||
|
||||
println!("🔍 Package Search");
|
||||
println!("=================");
|
||||
println!("Query: {}", query);
|
||||
|
||||
if opt_installed {
|
||||
println!("Filter: Installed packages only");
|
||||
} else if opt_available {
|
||||
println!("Filter: Available packages only");
|
||||
}
|
||||
|
||||
if opt_exact {
|
||||
println!("Matching: Exact package name");
|
||||
} else if opt_regex {
|
||||
println!("Matching: Regular expression");
|
||||
}
|
||||
|
||||
if opt_show_deps {
|
||||
println!("Show dependencies: Enabled");
|
||||
}
|
||||
|
||||
if let Some(ref limit) = opt_limit {
|
||||
println!("Result limit: {}", limit);
|
||||
}
|
||||
|
||||
println!("Status: Placeholder implementation");
|
||||
println!("Next: Implement real package search logic");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"search"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Search for packages in APT repositories"
|
||||
}
|
||||
|
||||
fn show_help(&self) {
|
||||
println!("apt-ostree search - Search for packages in APT repositories");
|
||||
println!();
|
||||
println!("Usage: apt-ostree search [OPTIONS] <QUERY>");
|
||||
println!();
|
||||
println!("Arguments:");
|
||||
println!(" QUERY Search query (package name, description, etc.)");
|
||||
println!();
|
||||
println!("Options:");
|
||||
println!(" --installed Show only installed packages");
|
||||
println!(" --available Show only available packages");
|
||||
println!(" --exact Exact package name matching");
|
||||
println!(" --regex Regular expression search (not yet implemented)");
|
||||
println!(" --show-deps Show package dependencies");
|
||||
println!(" --limit <NUMBER> Limit results to specified number");
|
||||
println!(" --help, -h Show this help message");
|
||||
println!();
|
||||
println!("Examples:");
|
||||
println!(" apt-ostree search vim");
|
||||
println!(" apt-ostree search --installed vim");
|
||||
println!(" apt-ostree search --exact vim");
|
||||
println!(" apt-ostree search --limit 5 editor");
|
||||
println!(" apt-ostree search --show-deps web server");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue