Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ repository = "https://github.com/ripytide/metapac"
readme = "README.md"
keywords = ["package-manager", "linux", "declarative", "cli"]
categories = ["command-line-utilities"]
authors = [
"James Forster <james.forsterer@gmail.com>",
"Md Isfarul Haque <md-isfarul-haque@proton.me",
]

[package.metadata.release]
allow-branch = ["main"]
Expand All @@ -34,7 +30,7 @@ dirs = "6.0.0"
home = "0.5.12"
pretty_env_logger = "0.5.0"
dialoguer = "0.12.0"
serde-inline-default = "1.0.0"
serde-inline-default = "1.0.1"
hostname = "0.4.2"
walkdir = "2.5.0"
toml_edit = { version = "0.24.0", features = ["serde", "display"] }
Expand Down
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,6 @@ locked = false
# Default: false
binstall = false

[flatpak]
# The default installation to use for flatpak packages. If equal to "user"
# then the --user option is passed when installing packages, if it is equal
# to "system" then the "--system" option is passed, and if it is equal to
# anything else then "--installation={installation}" is passed. If this is
# not set then nothing is passed. This config can be overridden on a
# per-package basis.
# Default: None
installation = "system"

[vscode]
# Since VSCode and VSCodium both operate on the same package database
# they are mutually exclusive and so you must pick which one you want
Expand All @@ -369,7 +359,6 @@ variant = "code"
# If this is `true` then the system is updated with the subcommand `dist-upgrade` (`dup`).
# Default: false
distribution_upgrade = false

```

## Group Files
Expand Down Expand Up @@ -490,19 +479,28 @@ dnf = {
packages = ["package1", { name = "package2" }]
}
flatpak = {
packages = [
"package1",
repos = [
{
name = "package2",
options = { remote = "flathub", installation = "user" },
name = "system:flathub",
options = { url = "https://dl.flathub.org/repo/" }
},
{
name = "package3",
options = { remote = "flathub", installation = "system" },
name = "user:ykc",
options = { url = "https://flatpak.yellowkeycard.net/ykc.flatpakrepo" }
},
{
name = "package4",
options = { remote = "flathub", installation = "my_custom_installation" },
name = "custom_installation:flathub_beta",
options = {
url = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo"
}
},
],
packages = [
{ name = "system:org.gimp.GIMP", options = { remote = "flathub" } },
{ name = "user:io.github.sonicgalactic", options = { remote = "ykc" } },
{
name = "custom_installation:org.mozilla.firefox",
options = { remote = "flathub_beta" }
},
]
}
Expand Down
25 changes: 19 additions & 6 deletions src/backends/apt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl Backend for Apt {
// designed with this use-case in mind so there are lots and
// lots of different methods all of which seem to have
// caveats.
let explicit = run_command_for_stdout(["apt-mark", "showmanual"], Perms::Same, false)?;
let explicit =
run_command_for_stdout(["apt-mark", "showmanual"], Perms::Same, StdErr::Show)?;
Ok(explicit
.lines()
.map(|x| (x.to_string(), Self::PackageOptions {}))
Expand Down Expand Up @@ -142,15 +143,27 @@ impl Backend for Apt {
Ok(BTreeMap::new())
}

fn add_repos(_: &BTreeMap<String, Self::RepoOptions>, _: bool, _: &Self::Config) -> Result<()> {
Err(eyre!("unimplemented"))
fn add_repos(
repos: &BTreeMap<String, Self::RepoOptions>,
_: bool,
_: &Self::Config,
) -> Result<()> {
if repos.is_empty() {
Ok(())
} else {
Err(eyre!("unimplemented"))
}
}

fn remove_repos(_: &BTreeSet<String>, _: bool, _: &Self::Config) -> Result<()> {
Err(eyre!("unimplemented"))
fn remove_repos(repos: &BTreeSet<String>, _: bool, _: &Self::Config) -> Result<()> {
if repos.is_empty() {
Ok(())
} else {
Err(eyre!("unimplemented"))
}
}

fn version(_: &Self::Config) -> Result<String> {
run_command_for_stdout(["apt", "--version"], Perms::Same, false)
run_command_for_stdout(["apt", "--version"], Perms::Same, StdErr::Show)
}
}
30 changes: 21 additions & 9 deletions src/backends/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ impl Backend for Arch {
"--quiet",
],
Perms::Same,
false,
StdErr::Show,
)?;

let installed = run_command_for_stdout(
[config.package_manager.as_command(), "--query", "--quiet"],
Perms::Same,
false,
StdErr::Show,
)?;

Ok(all
Expand All @@ -129,7 +129,7 @@ impl Backend for Arch {
"--quiet",
],
Perms::Same,
false,
StdErr::Show,
)?;

let mut result = BTreeMap::new();
Expand Down Expand Up @@ -189,7 +189,7 @@ impl Backend for Arch {
"--quiet",
],
Perms::Same,
false,
StdErr::Show,
)?;
let orphans = orphans_output.lines();

Expand Down Expand Up @@ -262,19 +262,31 @@ impl Backend for Arch {
Ok(BTreeMap::new())
}

fn add_repos(_: &BTreeMap<String, Self::RepoOptions>, _: bool, _: &Self::Config) -> Result<()> {
Err(eyre!("unimplemented"))
fn add_repos(
repos: &BTreeMap<String, Self::RepoOptions>,
_: bool,
_: &Self::Config,
) -> Result<()> {
if repos.is_empty() {
Ok(())
} else {
Err(eyre!("unimplemented"))
}
}

fn remove_repos(_: &BTreeSet<String>, _: bool, _: &Self::Config) -> Result<()> {
Err(eyre!("unimplemented"))
fn remove_repos(repos: &BTreeSet<String>, _: bool, _: &Self::Config) -> Result<()> {
if repos.is_empty() {
Ok(())
} else {
Err(eyre!("unimplemented"))
}
}

fn version(config: &Self::Config) -> Result<String> {
run_command_for_stdout(
[config.package_manager.as_command(), "--version"],
Perms::Same,
false,
StdErr::Show,
)
}
}
26 changes: 19 additions & 7 deletions src/backends/brew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ impl Backend for Brew {
let formulae = run_command_for_stdout(
["brew", "list", "-1", "--quiet", "--installed-on-request"],
Perms::Same,
false,
StdErr::Show,
)?;

let casks = run_command_for_stdout(
["brew", "list", "-1", "--cask", "--quiet"],
Perms::Same,
false,
StdErr::Show,
)?;

Ok(formulae
Expand Down Expand Up @@ -141,15 +141,27 @@ impl Backend for Brew {
Ok(BTreeMap::new())
}

fn add_repos(_: &BTreeMap<String, Self::RepoOptions>, _: bool, _: &Self::Config) -> Result<()> {
Err(eyre!("unimplemented"))
fn add_repos(
repos: &BTreeMap<String, Self::RepoOptions>,
_: bool,
_: &Self::Config,
) -> Result<()> {
if repos.is_empty() {
Ok(())
} else {
Err(eyre!("unimplemented"))
}
}

fn remove_repos(_: &BTreeSet<String>, _: bool, _: &Self::Config) -> Result<()> {
Err(eyre!("unimplemented"))
fn remove_repos(repos: &BTreeSet<String>, _: bool, _: &Self::Config) -> Result<()> {
if repos.is_empty() {
Ok(())
} else {
Err(eyre!("unimplemented"))
}
}

fn version(_: &Self::Config) -> Result<String> {
run_command_for_stdout(["brew", "--version"], Perms::Same, false)
run_command_for_stdout(["brew", "--version"], Perms::Same, StdErr::Show)
}
}
Loading