Added Hooks enum; Add some doc comments for Package; Add some useful

fields to `Package` struct; Add more cli functionality;
This commit is contained in:
Nathan Fisher 2023-03-24 13:18:52 -04:00
parent d6982b70e8
commit bc1f1ed082
4 changed files with 51 additions and 9 deletions

View File

@ -10,6 +10,7 @@ pub fn cli() -> Command {
.subcommands([
create(),
search(),
info(),
install(),
remove(),
upgrade(),
@ -83,6 +84,13 @@ fn search() -> Command {
])
}
fn info() -> Command {
Command::new("info")
.about("Display information about a specific package")
.arg(Arg::new("name")
.required(true))
}
fn install() -> Command {
Command::new("install")
.about("Install packages")

14
src/hooks/mod.rs Normal file
View File

@ -0,0 +1,14 @@
use std::error::Error;
#[non_exhaustive]
pub enum Hooks {
Man,
GlibSchema,
Info,
}
impl Hooks {
pub fn run(&self) -> Result<(), Box<dyn Error>> {
unimplemented!();
}
}

View File

@ -1,5 +1,6 @@
#![warn(clippy::all, clippy::pedantic)]
mod item;
mod hooks;
mod package;
mod plist;
mod repository;
@ -7,6 +8,7 @@ mod version;
pub use {
item::Item,
hooks::Hooks,
package::{Dependency, Package},
plist::*,
repository::Repository,

View File

@ -19,13 +19,31 @@ pub struct Group {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Package {
name: String,
version: Version,
release: u32,
plist: Plist,
size: usize,
dependencies: Vec<Dependency>,
users: Option<Vec<User>>,
groups: Option<Vec<Group>>,
post_install: Option<String>,
/// The name of the package minus all version information
pub name: String,
/// The `Version` of the package
pub version: Version,
/// The release number for this package
pub release: u32,
/// a single line description of the package
pub description: String,
/// a more verbose description of the package
pub long_description: String,
/// an optional link to an
/// [AppStream](https://www.freedesktop.org/wiki/Distributions/AppStream/)
/// metadata file
pub appstream_data: Option<String>,
/// a listing of all files, directories and symlinks which are a part of
/// this package
pub plist: Plist,
/// the total size of this package
pub size: usize,
/// all of this package's runtime dependencies
pub dependencies: Vec<Dependency>,
/// an optional list of users to be created upon installation
pub users: Option<Vec<User>>,
/// an optional list of groups to be created upon installation
pub groups: Option<Vec<Group>>,
/// an optional post installation shell script to be run
pub post_install: Option<String>,
}