Add OCaml package manager (OPAM) (#62)
This adds support for the OCaml package manager (OPAM). The command line `opam update` first performs a self-update if necessary. Then it updates its package list. Finally, `opam upgrade` upgrades all locally installed packages.
This commit is contained in:
committed by
Roey Darwish Dror
parent
c0ac3e483e
commit
c5ea22bac3
@@ -94,6 +94,23 @@ pub fn run_rustup(base_dirs: &BaseDirs, terminal: &mut Terminal, dry_run: bool)
|
||||
None
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn run_opam_update(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> {
|
||||
if let Some(opam) = utils::which("opam") {
|
||||
terminal.print_separator("OCaml Package Manager");
|
||||
|
||||
let success = || -> Result<(), Error> {
|
||||
Executor::new(&opam, dry_run).arg("update").spawn()?.wait()?.check()?;
|
||||
Executor::new(&opam, dry_run).arg("upgrade").spawn()?.wait()?.check()?;
|
||||
Ok(())
|
||||
}().is_ok();
|
||||
|
||||
return Some(("OPAM", success));
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn run_custom_command(name: &str, command: &str, terminal: &mut Terminal, dry_run: bool) -> Result<(), Error> {
|
||||
terminal.print_separator(name);
|
||||
|
||||
Reference in New Issue
Block a user