Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.

feat: Package Provider Optionals#157

Closed
martintc wants to merge 3 commits into
comtrya:mainfrom
martintc:packageprovider
Closed

feat: Package Provider Optionals#157
martintc wants to merge 3 commits into
comtrya:mainfrom
martintc:packageprovider

Conversation

@martintc
Copy link
Copy Markdown
Member

Still very much in draft. The idea is to refactor such that features of packages action return values wrapped in Option<>. Feature not implemented in package providers or incomplete can return None where comtrya will gracefully exit the action with a message that the feature is incomplete, not implemented or does not apply to the package manager.

@rawkode
Copy link
Copy Markdown
Member

rawkode commented Mar 21, 2022

@martintc I think this might be easier to implement if you take a look at providers/mod.rs

pub trait PackageProvider {
    fn name(&self) -> &str;
    fn available(&self) -> bool;
    fn bootstrap(&self) -> Vec<Step>;
    fn has_repository(&self, package: &PackageVariant) -> bool;
    fn add_repository(&self, package: &PackageVariant) -> Vec<Step>;
    fn query(&self, package: &PackageVariant) -> Vec<String>;
    fn install(&self, package: &PackageVariant) -> Vec<Step>;
}

You'll see this trait. Below it, you could implement generic functions that log a "Does not implement" inside a impl PackageProvider block.

Let me know if that doesn't make sense and I'll provide an example.

@martintc
Copy link
Copy Markdown
Member Author

@rawkode An example would be appreciated!

@martintc martintc closed this Mar 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants