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