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([ .subcommands([
create(), create(),
search(), search(),
info(),
install(), install(),
remove(), remove(),
upgrade(), 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 { fn install() -> Command {
Command::new("install") Command::new("install")
.about("Install packages") .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)] #![warn(clippy::all, clippy::pedantic)]
mod item; mod item;
mod hooks;
mod package; mod package;
mod plist; mod plist;
mod repository; mod repository;
@ -7,6 +8,7 @@ mod version;
pub use { pub use {
item::Item, item::Item,
hooks::Hooks,
package::{Dependency, Package}, package::{Dependency, Package},
plist::*, plist::*,
repository::Repository, repository::Repository,

View File

@ -19,13 +19,31 @@ pub struct Group {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Package { pub struct Package {
name: String, /// The name of the package minus all version information
version: Version, pub name: String,
release: u32, /// The `Version` of the package
plist: Plist, pub version: Version,
size: usize, /// The release number for this package
dependencies: Vec<Dependency>, pub release: u32,
users: Option<Vec<User>>, /// a single line description of the package
groups: Option<Vec<Group>>, pub description: String,
post_install: Option<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>,
} }