This repository has been archived by the owner on May 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(entry): start engine from init
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#![allow(dead_code)] | ||
|
||
// Todo: implement hash comparing of the file before installation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub struct PackageInfo { | ||
pub package: Package, | ||
pub maintainer: Maintainer, | ||
pub source: Source, | ||
pub bin: Bin, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub struct Package { | ||
pub name: String, | ||
pub version: String, | ||
pub description: String, | ||
pub license: String, | ||
pub conditions: Option<Conditions>, | ||
pub metadata: Metadata, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub struct Conditions { | ||
pub dependencies: Option<Vec<String>>, | ||
pub conflicts: Option<Vec<String>>, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub struct Metadata { | ||
pub hash: Option<String>, | ||
pub keywords: Option<Vec<String>>, | ||
pub categories: Option<Vec<String>>, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub struct Maintainer { | ||
pub name: String, | ||
pub email: String, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub struct Source { | ||
pub url: String, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub struct Bin { | ||
pub name: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use clap::Parser; | ||
|
||
pub async fn start() { | ||
let cli = crate::engine::args::Cli::parse(); | ||
|
||
let result = match cli.command { | ||
crate::engine::CommandChoice::Install(pkg_install_args) => { | ||
crate::commands::install::download_pkgs(pkg_install_args).await | ||
} | ||
crate::engine::CommandChoice::Remove(pkg_uninstall_args) => { | ||
crate::commands::uninstall::remove_pkgs(pkg_uninstall_args).await | ||
} | ||
}; | ||
|
||
if let Err(err) = result { | ||
eprintln!("Error: {}", err); | ||
std::process::exit(1); | ||
} | ||
} |