refactor: remove legacy deprecated macros (#583)
This commit is contained in:
@@ -2,188 +2,239 @@
|
|||||||
# [include] sections are processed in the order you write them
|
# [include] sections are processed in the order you write them
|
||||||
# Files in $CONFIG_DIR/topgrade.d/ are automatically included before this file
|
# Files in $CONFIG_DIR/topgrade.d/ are automatically included before this file
|
||||||
[include]
|
[include]
|
||||||
#paths = ["/etc/topgrade.toml"]
|
# paths = ["/etc/topgrade.toml"]
|
||||||
|
|
||||||
|
|
||||||
[misc]
|
[misc]
|
||||||
# Don't ask for confirmations
|
|
||||||
#assume_yes = true
|
|
||||||
|
|
||||||
# Disable specific steps - same options as the command line flag
|
|
||||||
#disable = ["system", "emacs"]
|
|
||||||
|
|
||||||
# Ignore failures for these steps
|
|
||||||
#ignore_failures = ["powershell"]
|
|
||||||
|
|
||||||
# Run specific steps - same options as the command line flag
|
|
||||||
#only = ["system", "emacs"]
|
|
||||||
|
|
||||||
# Do not ask to retry failed steps (default: false)
|
|
||||||
#no_retry = true
|
|
||||||
|
|
||||||
# Sudo command to be used
|
|
||||||
#sudo_command = "sudo"
|
|
||||||
|
|
||||||
# Run `sudo -v` to cache credentials at the start of the run
|
# Run `sudo -v` to cache credentials at the start of the run
|
||||||
# This avoids a blocking password prompt in the middle of an unattended run
|
# This avoids a blocking password prompt in the middle of an unattended run
|
||||||
#pre_sudo = false
|
# (default: false)
|
||||||
|
# pre_sudo = false
|
||||||
|
|
||||||
# Run inside tmux
|
# Sudo command to be used
|
||||||
#run_in_tmux = true
|
# sudo_command = "sudo"
|
||||||
|
|
||||||
|
# Disable specific steps - same options as the command line flag
|
||||||
|
# disable = ["system", "emacs"]
|
||||||
|
|
||||||
|
# Ignore failures for these steps
|
||||||
|
# ignore_failures = ["powershell"]
|
||||||
|
|
||||||
# List of remote machines with Topgrade installed on them
|
# List of remote machines with Topgrade installed on them
|
||||||
#remote_topgrades = ["toothless", "pi", "parnas"]
|
# remote_topgrades = ["toothless", "pi", "parnas"]
|
||||||
|
|
||||||
# Arguments to pass to SSH when upgrading remote systems
|
|
||||||
#ssh_arguments = "-o ConnectTimeout=2"
|
|
||||||
|
|
||||||
# Path to Topgrade executable on remote machines
|
# Path to Topgrade executable on remote machines
|
||||||
#remote_topgrade_path = ".cargo/bin/topgrade"
|
# remote_topgrade_path = ".cargo/bin/topgrade"
|
||||||
|
|
||||||
|
# Arguments to pass to SSH when upgrading remote systems
|
||||||
|
# ssh_arguments = "-o ConnectTimeout=2"
|
||||||
|
|
||||||
# Arguments to pass tmux when pulling Repositories
|
# Arguments to pass tmux when pulling Repositories
|
||||||
#tmux_arguments = "-S /var/tmux.sock"
|
# tmux_arguments = "-S /var/tmux.sock"
|
||||||
|
|
||||||
# Do not set the terminal title
|
# Do not set the terminal title (dfault: true)
|
||||||
#set_title = false
|
# set_title = true
|
||||||
|
|
||||||
# Display the time in step titles
|
# Display the time in step titles (default: true)
|
||||||
# display_time = true
|
# display_time = true
|
||||||
|
|
||||||
# Cleanup temporary or old files
|
# Don't ask for confirmations (no default value)
|
||||||
#cleanup = true
|
# assume_yes = true
|
||||||
|
|
||||||
# Skip sending a notification at the end of a run
|
# Do not ask to retry failed steps (default: false)
|
||||||
#skip_notify = true
|
# no_retry = true
|
||||||
|
|
||||||
# Whether to self update (this is ignored if the binary has been built without self update support, available also via setting the environment variable TOPGRADE_NO_SELF_UPGRADE)
|
# Run inside tmux (default: false)
|
||||||
#no_self_update = true
|
# run_in_tmux = true
|
||||||
|
|
||||||
# Extra Home Manager arguments
|
# Cleanup temporary or old files (default: false)
|
||||||
#home_manager_arguments = ["--flake", "file"]
|
# cleanup = true
|
||||||
|
|
||||||
|
# Send a notification for every step (default: false)
|
||||||
|
# notify_each_step = false
|
||||||
|
|
||||||
|
# Skip sending a notification at the end of a run (default: false)
|
||||||
|
# skip_notify = true
|
||||||
|
|
||||||
|
# The Bash-it branch to update (default: "stable")
|
||||||
|
# bashit_branch = "stable"
|
||||||
|
|
||||||
|
# Run specific steps - same options as the command line flag
|
||||||
|
# only = ["system", "emacs"]
|
||||||
|
|
||||||
|
# Whether to self update
|
||||||
|
#
|
||||||
|
# this will be ignored if the binary is built without self update support
|
||||||
|
#
|
||||||
|
# available also via setting the environment variable TOPGRADE_NO_SELF_UPGRADE)
|
||||||
|
# no_self_update = true
|
||||||
|
|
||||||
# Extra tracing filter directives
|
# Extra tracing filter directives
|
||||||
# These are prepended to the `--log-filter` argument
|
# These are prepended to the `--log-filter` argument
|
||||||
# See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
|
# See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
|
||||||
#log_filters = ["topgrade::command=debug", "warn"]
|
# log_filters = ["topgrade::command=debug", "warn"]
|
||||||
|
|
||||||
|
|
||||||
# Commands to run before anything
|
# Commands to run before anything
|
||||||
[pre_commands]
|
[pre_commands]
|
||||||
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
|
# "Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
|
||||||
|
|
||||||
|
|
||||||
# Commands to run after anything
|
# Commands to run after anything
|
||||||
[post_commands]
|
[post_commands]
|
||||||
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
|
# "Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
|
||||||
|
|
||||||
|
|
||||||
# Custom commands
|
# Custom commands
|
||||||
[commands]
|
[commands]
|
||||||
#"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
|
# "Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
|
||||||
#"Custom command using interactive shell (unix)" = "-i vim_upgrade"
|
# "Custom command using interactive shell (unix)" = "-i vim_upgrade"
|
||||||
|
|
||||||
|
|
||||||
[python]
|
[python]
|
||||||
#enable_pip_review = true ###disabled by default
|
# enable_pip_review = true ###disabled by default
|
||||||
#enable_pip_review_local = true ###disabled by default
|
# enable_pip_review_local = true ###disabled by default
|
||||||
#enable_pipupgrade = true ###disabled by default
|
# enable_pipupgrade = true ###disabled by default
|
||||||
#pipupgrade_arguments = "-y -u --pip-path pip" ###disabled by default
|
# pipupgrade_arguments = "-y -u --pip-path pip" ###disabled by default
|
||||||
|
|
||||||
|
|
||||||
[composer]
|
[composer]
|
||||||
#self_update = true
|
# self_update = true
|
||||||
|
|
||||||
|
|
||||||
[brew]
|
[brew]
|
||||||
#greedy_cask = true
|
# greedy_cask = true
|
||||||
#autoremove = true
|
# autoremove = true
|
||||||
|
|
||||||
|
|
||||||
[linux]
|
[linux]
|
||||||
# Arch Package Manager to use. Allowed values: autodetect, aura, garuda_update, pacman, pamac, paru, pikaur, trizen, yay.
|
# Arch Package Manager to use.
|
||||||
#arch_package_manager = "pacman"
|
# Allowed values:
|
||||||
|
# autodetect, aura, garuda_update, pacman, pamac, paru, pikaur, trizen, yay
|
||||||
|
# arch_package_manager = "pacman"
|
||||||
|
|
||||||
# Arguments to pass yay (or paru) when updating packages
|
# Arguments to pass yay (or paru) when updating packages
|
||||||
#yay_arguments = "--nodevel"
|
# yay_arguments = "--nodevel"
|
||||||
|
|
||||||
# Arguments to pass dnf when updating packages
|
# Arguments to pass dnf when updating packages
|
||||||
#dnf_arguments = "--refresh"
|
# dnf_arguments = "--refresh"
|
||||||
#aura_aur_arguments = "-kx"
|
|
||||||
#aura_pacman_arguments = ""
|
# aura_aur_arguments = "-kx"
|
||||||
#garuda_update_arguments = ""
|
|
||||||
#show_arch_news = true
|
# aura_pacman_arguments = ""
|
||||||
#trizen_arguments = "--devel"
|
# garuda_update_arguments = ""
|
||||||
#pikaur_arguments = ""
|
|
||||||
#pamac_arguments = "--no-devel"
|
# show_arch_news = true
|
||||||
#enable_tlmgr = true
|
|
||||||
#emerge_sync_flags = "-q"
|
# trizen_arguments = "--devel"
|
||||||
#emerge_update_flags = "-uDNa --with-bdeps=y world"
|
|
||||||
#redhat_distro_sync = false
|
# pikaur_arguments = ""
|
||||||
#suse_dup = false
|
|
||||||
#rpm_ostree = false
|
# pamac_arguments = "--no-devel"
|
||||||
#nix_arguments = "--flake"
|
|
||||||
#nix_env_arguments = "--prebuilt-only"
|
# enable_tlmgr = true
|
||||||
|
|
||||||
|
# emerge_sync_flags = "-q"
|
||||||
|
|
||||||
|
# emerge_update_flags = "-uDNa --with-bdeps=y world"
|
||||||
|
|
||||||
|
# redhat_distro_sync = false
|
||||||
|
|
||||||
|
# suse_dup = false
|
||||||
|
|
||||||
|
# rpm_ostree = false
|
||||||
|
|
||||||
|
# nix_arguments = "--flake"
|
||||||
|
|
||||||
|
# nix_env_arguments = "--prebuilt-only"
|
||||||
|
|
||||||
|
# Extra Home Manager arguments
|
||||||
|
# home_manager_arguments = ["--flake", "file"]
|
||||||
|
|
||||||
|
|
||||||
[git]
|
[git]
|
||||||
#max_concurrency = 5
|
# max_concurrency = 5
|
||||||
|
|
||||||
# Git repositories that you want to pull and push
|
# Git repositories that you want to pull and push
|
||||||
#repos = [
|
# repos = [
|
||||||
# "~/src/*/",
|
# "~/src/*/",
|
||||||
# "~/.config/something"
|
# "~/.config/something"
|
||||||
#]
|
# ]
|
||||||
|
|
||||||
# Repositories that you only want to pull
|
# Repositories that you only want to pull
|
||||||
#pull_only_repos = [
|
# pull_only_repos = [
|
||||||
# "~/.config/something_else"
|
# "~/.config/something_else"
|
||||||
#]
|
# ]
|
||||||
|
|
||||||
# Repositories that you only want to push
|
# Repositories that you only want to push
|
||||||
#push_only_repos = [
|
# push_only_repos = [
|
||||||
# "~/src/*/",
|
# "~/src/*/",
|
||||||
# "~/.config/something_third"
|
# "~/.config/something_third"
|
||||||
#]
|
# ]
|
||||||
|
|
||||||
# Don't pull the predefined git repos
|
# Don't pull the predefined git repos
|
||||||
#pull_predefined = false
|
# pull_predefined = false
|
||||||
|
|
||||||
# Arguments to pass Git when pulling repositories
|
# Arguments to pass Git when pulling repositories
|
||||||
#pull_arguments = "--rebase --autostash"
|
# pull_arguments = "--rebase --autostash"
|
||||||
|
|
||||||
# Arguments to pass Git when pushing repositories
|
# Arguments to pass Git when pushing repositories
|
||||||
#push_arguments = "--all"
|
# push_arguments = "--all"
|
||||||
|
|
||||||
|
|
||||||
[windows]
|
[windows]
|
||||||
# Manually select Windows updates
|
# Manually select Windows updates
|
||||||
#accept_all_updates = false
|
# accept_all_updates = false
|
||||||
#open_remotes_in_new_terminal = true
|
|
||||||
#wsl_update_pre_release = true
|
# open_remotes_in_new_terminal = true
|
||||||
#wsl_update_use_web_download = true
|
|
||||||
|
# wsl_update_pre_release = true
|
||||||
|
|
||||||
|
# wsl_update_use_web_download = true
|
||||||
|
|
||||||
# Causes Topgrade to rename itself during the run to allow package managers
|
# Causes Topgrade to rename itself during the run to allow package managers
|
||||||
# to upgrade it. Use this only if you installed Topgrade by using a package
|
# to upgrade it. Use this only if you installed Topgrade by using a package
|
||||||
# manager such as Scoop or Cargo
|
# manager such as Scoop or Cargo
|
||||||
#self_rename = true
|
# self_rename = true
|
||||||
|
|
||||||
|
|
||||||
[npm]
|
[npm]
|
||||||
# Use sudo if the NPM directory isn't owned by the current user
|
# Use sudo if the NPM directory isn't owned by the current user
|
||||||
#use_sudo = true
|
# use_sudo = true
|
||||||
|
|
||||||
|
|
||||||
[yarn]
|
[yarn]
|
||||||
# Run `yarn global upgrade` with `sudo`
|
# Run `yarn global upgrade` with `sudo`
|
||||||
#use_sudo = true
|
# use_sudo = true
|
||||||
|
|
||||||
|
|
||||||
[vim]
|
[vim]
|
||||||
# For `vim-plug`, execute `PlugUpdate!` instead of `PlugUpdate`
|
# For `vim-plug`, execute `PlugUpdate!` instead of `PlugUpdate`
|
||||||
#force_plug_update = true
|
# force_plug_update = true
|
||||||
|
|
||||||
|
|
||||||
[firmware]
|
[firmware]
|
||||||
# Offer to update firmware; if false just check for and display available updates
|
# Offer to update firmware; if false just check for and display available updates
|
||||||
#upgrade = true
|
# upgrade = true
|
||||||
|
|
||||||
|
|
||||||
[vagrant]
|
[vagrant]
|
||||||
# Vagrant directories
|
# Vagrant directories
|
||||||
#directories = []
|
# directories = []
|
||||||
|
|
||||||
# power on vagrant boxes if needed
|
# power on vagrant boxes if needed
|
||||||
#power_on = true
|
# power_on = true
|
||||||
|
|
||||||
# Always suspend vagrant boxes instead of powering off
|
# Always suspend vagrant boxes instead of powering off
|
||||||
#always_suspend = true
|
# always_suspend = true
|
||||||
|
|
||||||
|
|
||||||
[flatpak]
|
[flatpak]
|
||||||
# Use sudo for updating the system-wide installation
|
# Use sudo for updating the system-wide installation
|
||||||
#use_sudo = true
|
# use_sudo = true
|
||||||
|
|
||||||
|
|
||||||
[distrobox]
|
[distrobox]
|
||||||
#use_root = false
|
# use_root = false
|
||||||
#containers = ["archlinux-latest"]
|
|
||||||
|
# containers = ["archlinux-latest"]
|
||||||
117
src/config.rs
117
src/config.rs
@@ -42,57 +42,6 @@ macro_rules! str_value {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! check_deprecated {
|
|
||||||
($config:expr, $old:ident, $section:ident, $new:ident) => {
|
|
||||||
if $config.$old.is_some() {
|
|
||||||
println!(concat!(
|
|
||||||
"'",
|
|
||||||
stringify!($old),
|
|
||||||
"' configuration option is deprecated. Rename it to '",
|
|
||||||
stringify!($new),
|
|
||||||
"' and put it under the section [",
|
|
||||||
stringify!($section),
|
|
||||||
"]",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a deprecated option moved from a section to another
|
|
||||||
macro_rules! get_deprecated_moved_opt {
|
|
||||||
($old_section:expr, $old:ident, $new_section:expr, $new:ident) => {{
|
|
||||||
if let Some(old_section) = &$old_section {
|
|
||||||
if old_section.$old.is_some() {
|
|
||||||
return &old_section.$old;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(new_section) = &$new_section {
|
|
||||||
return &new_section.$new;
|
|
||||||
}
|
|
||||||
|
|
||||||
return &None;
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! get_deprecated_moved_or_default_to {
|
|
||||||
($old_section:expr, $old:ident, $new_section:expr, $new:ident, $default_ret:ident) => {{
|
|
||||||
if let Some(old_section) = &$old_section {
|
|
||||||
if let Some(old) = old_section.$old {
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(new_section) = &$new_section {
|
|
||||||
if let Some(new) = new_section.$new {
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $default_ret;
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type Commands = BTreeMap<String, String>;
|
pub type Commands = BTreeMap<String, String>;
|
||||||
|
|
||||||
#[derive(ArgEnum, EnumString, EnumVariantNames, Debug, Clone, PartialEq, Eq, Deserialize, EnumIter, Copy)]
|
#[derive(ArgEnum, EnumString, EnumVariantNames, Debug, Clone, PartialEq, Eq, Deserialize, EnumIter, Copy)]
|
||||||
@@ -390,11 +339,6 @@ pub struct Misc {
|
|||||||
|
|
||||||
sudo_command: Option<SudoKind>,
|
sudo_command: Option<SudoKind>,
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
|
|
||||||
git_repos: Option<Vec<String>>,
|
|
||||||
|
|
||||||
predefined_git_repos: Option<bool>,
|
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
|
||||||
disable: Option<Vec<Step>>,
|
disable: Option<Vec<Step>>,
|
||||||
|
|
||||||
@@ -409,9 +353,6 @@ pub struct Misc {
|
|||||||
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
||||||
ssh_arguments: Option<String>,
|
ssh_arguments: Option<String>,
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
|
||||||
git_arguments: Option<String>,
|
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
||||||
tmux_arguments: Option<String>,
|
tmux_arguments: Option<String>,
|
||||||
|
|
||||||
@@ -421,15 +362,6 @@ pub struct Misc {
|
|||||||
|
|
||||||
assume_yes: Option<bool>,
|
assume_yes: Option<bool>,
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
|
||||||
yay_arguments: Option<String>,
|
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
|
||||||
aura_aur_arguments: Option<String>,
|
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
|
|
||||||
aura_pacman_arguments: Option<String>,
|
|
||||||
|
|
||||||
no_retry: Option<bool>,
|
no_retry: Option<bool>,
|
||||||
|
|
||||||
run_in_tmux: Option<bool>,
|
run_in_tmux: Option<bool>,
|
||||||
@@ -438,8 +370,6 @@ pub struct Misc {
|
|||||||
|
|
||||||
notify_each_step: Option<bool>,
|
notify_each_step: Option<bool>,
|
||||||
|
|
||||||
accept_all_windows_updates: Option<bool>,
|
|
||||||
|
|
||||||
skip_notify: Option<bool>,
|
skip_notify: Option<bool>,
|
||||||
|
|
||||||
bashit_branch: Option<String>,
|
bashit_branch: Option<String>,
|
||||||
@@ -677,16 +607,6 @@ impl ConfigFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(misc) = &mut result.misc {
|
|
||||||
if let Some(ref mut paths) = &mut misc.git_repos {
|
|
||||||
for path in paths.iter_mut() {
|
|
||||||
let expanded = shellexpand::tilde::<&str>(&path.as_ref()).into_owned();
|
|
||||||
debug!("Path {} expanded to {}", path, expanded);
|
|
||||||
*path = expanded;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(paths) = result.git.as_mut().and_then(|git| git.repos.as_mut()) {
|
if let Some(paths) = result.git.as_mut().and_then(|git| git.repos.as_mut()) {
|
||||||
for path in paths.iter_mut() {
|
for path in paths.iter_mut() {
|
||||||
let expanded = shellexpand::tilde::<&str>(&path.as_ref()).into_owned();
|
let expanded = shellexpand::tilde::<&str>(&path.as_ref()).into_owned();
|
||||||
@@ -909,14 +829,6 @@ impl Config {
|
|||||||
ConfigFile::default()
|
ConfigFile::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(misc) = &config_file.misc {
|
|
||||||
check_deprecated!(misc, git_arguments, git, arguments);
|
|
||||||
check_deprecated!(misc, git_repos, git, repos);
|
|
||||||
check_deprecated!(misc, predefined_git_repos, git, pull_predefined);
|
|
||||||
check_deprecated!(misc, yay_arguments, linux, yay_arguments);
|
|
||||||
check_deprecated!(misc, accept_all_windows_updates, windows, accept_all_updates);
|
|
||||||
}
|
|
||||||
|
|
||||||
let allowed_steps = Self::allowed_steps(&opt, &config_file);
|
let allowed_steps = Self::allowed_steps(&opt, &config_file);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
@@ -947,8 +859,8 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The list of git repositories to push and pull.
|
/// The list of git repositories to push and pull.
|
||||||
pub fn git_repos(&self) -> &Option<Vec<String>> {
|
pub fn git_repos(&self) -> Option<&Vec<String>> {
|
||||||
get_deprecated_moved_opt!(&self.config_file.misc, git_repos, &self.config_file.git, repos)
|
self.config_file.git.as_ref().and_then(|git| git.repos.as_ref())
|
||||||
}
|
}
|
||||||
/// The list of additional git repositories to pull.
|
/// The list of additional git repositories to pull.
|
||||||
pub fn git_pull_only_repos(&self) -> Option<&Vec<String>> {
|
pub fn git_pull_only_repos(&self) -> Option<&Vec<String>> {
|
||||||
@@ -1158,13 +1070,11 @@ impl Config {
|
|||||||
|
|
||||||
/// Whether to accept all Windows updates
|
/// Whether to accept all Windows updates
|
||||||
pub fn accept_all_windows_updates(&self) -> bool {
|
pub fn accept_all_windows_updates(&self) -> bool {
|
||||||
get_deprecated_moved_or_default_to!(
|
self.config_file
|
||||||
&self.config_file.misc,
|
.windows
|
||||||
accept_all_windows_updates,
|
.as_ref()
|
||||||
&self.config_file.windows,
|
.and_then(|windows| windows.accept_all_updates)
|
||||||
accept_all_updates,
|
.unwrap_or(true)
|
||||||
true
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether to self rename the Topgrade executable during the run
|
/// Whether to self rename the Topgrade executable during the run
|
||||||
@@ -1447,13 +1357,12 @@ impl Config {
|
|||||||
|
|
||||||
pub fn use_predefined_git_repos(&self) -> bool {
|
pub fn use_predefined_git_repos(&self) -> bool {
|
||||||
!self.opt.disable_predefined_git_repos
|
!self.opt.disable_predefined_git_repos
|
||||||
&& get_deprecated_moved_or_default_to!(
|
&& self
|
||||||
&self.config_file.misc,
|
.config_file
|
||||||
predefined_git_repos,
|
.git
|
||||||
&self.config_file.git,
|
.as_ref()
|
||||||
pull_predefined,
|
.and_then(|git| git.pull_predefined)
|
||||||
true
|
.unwrap_or(true)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verbose(&self) -> bool {
|
pub fn verbose(&self) -> bool {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ pub enum GitAction {
|
|||||||
Pull,
|
Pull,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Repositories<'a> {
|
pub struct Repositories<'a> {
|
||||||
git: &'a Git,
|
git: &'a Git,
|
||||||
pull_repositories: HashSet<String>,
|
pull_repositories: HashSet<String>,
|
||||||
@@ -387,14 +388,27 @@ impl<'a> Repositories<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return true if `pull_repos` and `push_repos` are both empty.
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.pull_repositories.is_empty() && self.push_repositories.is_empty()
|
self.pull_repositories.is_empty() && self.push_repositories.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The following 2 functions are `#[cfg(unix)]` because they are only used in
|
||||||
|
// the `oh-my-zsh` step, which is UNIX-only.
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub fn remove(&mut self, path: &str) {
|
/// Return true if `pull_repos` is empty.
|
||||||
|
pub fn pull_is_empty(&self) -> bool {
|
||||||
|
self.pull_repositories.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
/// Remove `path` from `pull_repos`
|
||||||
|
///
|
||||||
|
/// # Panic
|
||||||
|
/// Will panic if `path` is not in the `pull_repos` under a debug build.
|
||||||
|
pub fn remove_from_pull(&mut self, path: &str) {
|
||||||
let _removed = self.pull_repositories.remove(path);
|
let _removed = self.pull_repositories.remove(path);
|
||||||
let _removed = self.push_repositories.remove(path);
|
|
||||||
debug_assert!(_removed);
|
debug_assert!(_removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,8 +230,8 @@ pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
custom_repos.insert_if_repo(entry.path(), crate::steps::git::GitAction::Pull);
|
custom_repos.insert_if_repo(entry.path(), crate::steps::git::GitAction::Pull);
|
||||||
}
|
}
|
||||||
|
|
||||||
custom_repos.remove(&oh_my_zsh.to_string_lossy());
|
custom_repos.remove_from_pull(&oh_my_zsh.to_string_lossy());
|
||||||
if !custom_repos.is_empty() {
|
if !custom_repos.pull_is_empty() {
|
||||||
println!("Pulling custom plugins and themes");
|
println!("Pulling custom plugins and themes");
|
||||||
ctx.git().multi_pull(&custom_repos, ctx)?;
|
ctx.git().multi_pull(&custom_repos, ctx)?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user