You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
Rust
54 lines
1.5 KiB
Rust
mod download;
|
|
mod query;
|
|
mod list;
|
|
mod remove;
|
|
mod repository;
|
|
mod install;
|
|
mod package;
|
|
mod config;
|
|
|
|
use crate::repository::find_package_in_repositories;
|
|
|
|
fn main() {
|
|
let operation = std::env::args().nth(1).expect("too few arguments!"); // Get the operation
|
|
match operation.as_str() {
|
|
"upgrade" | "u" => { // Will upgrade the selected package(s).
|
|
|
|
}
|
|
"install" | "i" => { // Install the selected package(s).
|
|
if std::env::args().nth(2).expect("too few arguments!") == "--archive" { // Indicates that the package(s) are archives instead of folders.
|
|
|
|
} else {
|
|
let package_name = std::env::args().nth(2).expect("too few arguments!"); // Get the first package name
|
|
find_package_in_repositories(&package_name, None); // Go through and find the package
|
|
println!("Reading package list");
|
|
let package_list = sled::open(crate::config::read_config().installation_path + "packages").expect("Failed to open package list");
|
|
if package_list.contains_key(&package_name).expect("Unexpected error") {
|
|
println!("Package was found in package list, checking for updates");
|
|
}
|
|
}
|
|
}
|
|
"remove" | "r" => {
|
|
|
|
}
|
|
"list" | "l" => {
|
|
|
|
}
|
|
"query" | "q" => {
|
|
|
|
}
|
|
"config" | "c" => {
|
|
|
|
}
|
|
"repository" | "repo" => {
|
|
|
|
}
|
|
_ => {
|
|
panic!("Unknown operation: {}", operation);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|