Add a flag to disable the predefined git repositories (fix #305)
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
# "~/.config/something"
|
||||
#]
|
||||
|
||||
# Don't pull the predefined git repos
|
||||
# predefined_git_repos = false
|
||||
|
||||
# Disable specific steps - same options as the command line flag
|
||||
#disable = ["system", "emacs"]
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ pub struct ConfigFile {
|
||||
pre_commands: Option<Commands>,
|
||||
commands: Option<Commands>,
|
||||
git_repos: Option<Vec<String>>,
|
||||
predefined_git_repos: Option<bool>,
|
||||
disable: Option<Vec<Step>>,
|
||||
remote_topgrades: Option<Vec<String>>,
|
||||
ssh_arguments: Option<String>,
|
||||
@@ -189,6 +190,10 @@ pub struct CommandLineArgs {
|
||||
/// Say yes to package manager's prompt (experimental)
|
||||
#[structopt(short = "y", long = "yes")]
|
||||
yes: bool,
|
||||
|
||||
/// Disable predefined_git_repos
|
||||
#[structopt(long = "disable-predefined-git-repos")]
|
||||
disable_predefined_git_repos: bool,
|
||||
}
|
||||
|
||||
impl CommandLineArgs {
|
||||
@@ -349,4 +354,8 @@ impl Config {
|
||||
None => "--devel",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn use_predefined_git_repos(&self) -> bool {
|
||||
!self.opt.disable_predefined_git_repos && self.config_file.predefined_git_repos.unwrap_or(true)
|
||||
}
|
||||
}
|
||||
|
||||
61
src/main.rs
61
src/main.rs
@@ -233,38 +233,41 @@ fn run() -> Result<()> {
|
||||
}
|
||||
|
||||
let emacs = emacs::Emacs::new(&base_dirs);
|
||||
if config.should_run(Step::Emacs) {
|
||||
if let Some(directory) = emacs.directory() {
|
||||
git_repos.insert(directory);
|
||||
}
|
||||
git_repos.insert(base_dirs.home_dir().join(".doom.d"));
|
||||
}
|
||||
|
||||
if config.should_run(Step::Vim) {
|
||||
git_repos.insert(base_dirs.home_dir().join(".vim"));
|
||||
git_repos.insert(base_dirs.home_dir().join(".config/nvim"));
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
if config.use_predefined_git_repos()
|
||||
{
|
||||
git_repos.insert(zsh::zshrc(&base_dirs));
|
||||
git_repos.insert(base_dirs.home_dir().join(".tmux"));
|
||||
git_repos.insert(base_dirs.home_dir().join(".config/fish"));
|
||||
git_repos.insert(base_dirs.config_dir().join("openbox"));
|
||||
git_repos.insert(base_dirs.config_dir().join("bspwm"));
|
||||
git_repos.insert(base_dirs.config_dir().join("i3"));
|
||||
git_repos.insert(base_dirs.config_dir().join("sway"));
|
||||
}
|
||||
if config.should_run(Step::Emacs) {
|
||||
if let Some(directory) = emacs.directory() {
|
||||
git_repos.insert(directory);
|
||||
}
|
||||
git_repos.insert(base_dirs.home_dir().join(".doom.d"));
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
git_repos.insert(
|
||||
base_dirs
|
||||
.data_local_dir()
|
||||
.join("Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState"),
|
||||
);
|
||||
if config.should_run(Step::Vim) {
|
||||
git_repos.insert(base_dirs.home_dir().join(".vim"));
|
||||
git_repos.insert(base_dirs.home_dir().join(".config/nvim"));
|
||||
}
|
||||
|
||||
if let Some(profile) = powershell.profile() {
|
||||
git_repos.insert(profile);
|
||||
#[cfg(unix)]
|
||||
{
|
||||
git_repos.insert(zsh::zshrc(&base_dirs));
|
||||
git_repos.insert(base_dirs.home_dir().join(".tmux"));
|
||||
git_repos.insert(base_dirs.home_dir().join(".config/fish"));
|
||||
git_repos.insert(base_dirs.config_dir().join("openbox"));
|
||||
git_repos.insert(base_dirs.config_dir().join("bspwm"));
|
||||
git_repos.insert(base_dirs.config_dir().join("i3"));
|
||||
git_repos.insert(base_dirs.config_dir().join("sway"));
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
git_repos.insert(
|
||||
base_dirs
|
||||
.data_local_dir()
|
||||
.join("Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState"),
|
||||
);
|
||||
|
||||
if let Some(profile) = powershell.profile() {
|
||||
git_repos.insert(profile);
|
||||
}
|
||||
}
|
||||
|
||||
if config.should_run(Step::GitRepos) {
|
||||
|
||||
Reference in New Issue
Block a user