Pull Powershell profile
This commit is contained in:
@@ -33,6 +33,7 @@ Just run `topgrade`. It will run the following steps:
|
|||||||
* ~/.config/fish
|
* ~/.config/fish
|
||||||
* ~/.config/nvim
|
* ~/.config/nvim
|
||||||
* ~/.vim
|
* ~/.vim
|
||||||
|
* Powershell Profile
|
||||||
* Custom defined paths
|
* Custom defined paths
|
||||||
* *Unix*: Run [zplug](https://github.com/zplug/zplug) update
|
* *Unix*: Run [zplug](https://github.com/zplug/zplug) update
|
||||||
* *Unix*: Run [fisherman](https://github.com/fisherman/fisherman) update
|
* *Unix*: Run [fisherman](https://github.com/fisherman/fisherman) update
|
||||||
|
|||||||
@@ -123,6 +123,13 @@ fn run() -> Result<(), Error> {
|
|||||||
git_repos.insert(base_dirs.home_dir().join(".config/fish"));
|
git_repos.insert(base_dirs.home_dir().join(".config/fish"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
if let Some(profile) = powershell.profile() {
|
||||||
|
git_repos.insert(profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(custom_git_repos) = config.git_repos() {
|
if let Some(custom_git_repos) = config.git_repos() {
|
||||||
for git_repo in custom_git_repos {
|
for git_repo in custom_git_repos {
|
||||||
git_repos.insert(git_repo);
|
git_repos.insert(git_repo);
|
||||||
|
|||||||
@@ -41,6 +41,24 @@ impl Powershell {
|
|||||||
}().is_ok()
|
}().is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn profile(&self) -> Option<PathBuf> {
|
||||||
|
if let Some(powershell) = &self.path {
|
||||||
|
let result = || -> Result<PathBuf, failure::Error> {
|
||||||
|
let output = Command::new(powershell).args(&["-Command", "echo $profile"]).output()?;
|
||||||
|
output.status.check()?;
|
||||||
|
Ok(PathBuf::from(
|
||||||
|
String::from_utf8_lossy(&output.stdout).trim().to_string(),
|
||||||
|
))
|
||||||
|
}();
|
||||||
|
|
||||||
|
match result {
|
||||||
|
Err(e) => error!("Error getting Powershell profile: {}", e),
|
||||||
|
Ok(path) => return Some(path),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn update_modules(&self, terminal: &mut Terminal) -> Option<(&'static str, bool)> {
|
pub fn update_modules(&self, terminal: &mut Terminal) -> Option<(&'static str, bool)> {
|
||||||
if let Some(powershell) = &self.path {
|
if let Some(powershell) = &self.path {
|
||||||
|
|||||||
Reference in New Issue
Block a user