* Make every step configureable (fix #244) * Fix
This commit is contained in:
committed by
GitHub
parent
1182675170
commit
6021a551ac
@@ -22,30 +22,28 @@ type Commands = BTreeMap<String, String>;
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum Step {
|
||||
/// Don't perform system upgrade
|
||||
System,
|
||||
/// Don't perform upgrades of package managers
|
||||
PackageManagers,
|
||||
/// Don't pull git repositories
|
||||
GitRepos,
|
||||
/// Don't upgrade Vim packages or configuration files
|
||||
Vim,
|
||||
/// Don't upgrade Emacs packages or configuration files
|
||||
Emacs,
|
||||
/// Don't upgrade ruby gems
|
||||
Gem,
|
||||
/// Don't upgrade npm/composer/yarn packages
|
||||
Node,
|
||||
/// Don't upgrade SDKMAN! and its packages
|
||||
Sdkman,
|
||||
/// Don't run remote Togprades
|
||||
Remotes,
|
||||
/// Don't run Rustup
|
||||
Rustup,
|
||||
/// Don't run Cargo
|
||||
Cargo,
|
||||
/// Don't update Powershell modules
|
||||
Shell,
|
||||
Opam,
|
||||
Vcpkg,
|
||||
Pipx,
|
||||
Stack,
|
||||
Myrepos,
|
||||
Pearl,
|
||||
Jetpack,
|
||||
Atom,
|
||||
Firmware,
|
||||
Restarts,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
|
||||
36
src/main.rs
36
src/main.rs
@@ -201,10 +201,10 @@ fn run() -> Result<(), Error> {
|
||||
|| unix::run_homebrew(config.cleanup(), run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
execute(&mut report, "nix", || unix::run_nix(run_type), config.no_retry())?;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
{
|
||||
@@ -343,44 +343,66 @@ fn run() -> Result<(), Error> {
|
||||
execute(&mut report, "Emacs", || emacs.upgrade(run_type), config.no_retry())?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Opam) {
|
||||
execute(
|
||||
&mut report,
|
||||
"opam",
|
||||
|| generic::run_opam_update(run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Vcpkg) {
|
||||
execute(
|
||||
&mut report,
|
||||
"vcpkg",
|
||||
|| generic::run_vcpkg_update(run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Pipx) {
|
||||
execute(
|
||||
&mut report,
|
||||
"pipx",
|
||||
|| generic::run_pipx_update(run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Stack) {
|
||||
execute(
|
||||
&mut report,
|
||||
"stack",
|
||||
|| generic::run_stack_update(run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Myrepos) {
|
||||
execute(
|
||||
&mut report,
|
||||
"myrepos",
|
||||
|| generic::run_myrepos_update(&base_dirs, run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
if config.should_run(Step::Pearl) {
|
||||
execute(&mut report, "pearl", || unix::run_pearl(run_type), config.no_retry())?;
|
||||
}
|
||||
}
|
||||
|
||||
if config.should_run(Step::Jetpack) {
|
||||
execute(
|
||||
&mut report,
|
||||
"jetpak",
|
||||
|| generic::run_jetpack(run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Vim) {
|
||||
execute(
|
||||
@@ -430,7 +452,11 @@ fn run() -> Result<(), Error> {
|
||||
target_os = "netbsd",
|
||||
target_os = "dragonfly"
|
||||
)))]
|
||||
{
|
||||
if config.should_run(Step::Atom) {
|
||||
execute(&mut report, "apm", || generic::run_apm(run_type), config.no_retry())?;
|
||||
}
|
||||
}
|
||||
|
||||
if config.should_run(Step::Gem) {
|
||||
execute(
|
||||
@@ -472,6 +498,7 @@ fn run() -> Result<(), Error> {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if config.should_run(Step::System) {
|
||||
execute(
|
||||
&mut report,
|
||||
"pihole",
|
||||
@@ -484,12 +511,18 @@ fn run() -> Result<(), Error> {
|
||||
|| linux::run_rpi_update(sudo.as_ref(), run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Firmware) {
|
||||
execute(
|
||||
&mut report,
|
||||
"Firmware upgrades",
|
||||
|| linux::run_fwupdmgr(run_type),
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
|
||||
if config.should_run(Step::Restarts) {
|
||||
execute(
|
||||
&mut report,
|
||||
"Restarts",
|
||||
@@ -497,6 +530,7 @@ fn run() -> Result<(), Error> {
|
||||
config.no_retry(),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user