Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/git/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::process::Command;

use crate::env;
use crate::nxfs::config::LogLevel;
use crate::utils;
use crate::utils::log::log_from_log_level;

use lrncore::usage_exit::command_usage;

Expand Down Expand Up @@ -135,3 +137,14 @@ fn show_stash() {
.expect("Failed to call the git shortlog command");
println!("{}", str::from_utf8(&list.stdout).unwrap());
}

pub fn git_pull() {
let mut pull = Command::new("git")
.arg("pull")
.spawn()
.expect("Failed to execute pull command");
let wait_pull = pull.wait().expect("Failed to wait pull command");
if !wait_pull.success() {
log_from_log_level(LogLevel::Error, "Failed to pull from remote repository");
}
}
3 changes: 2 additions & 1 deletion src/upgrade/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils;
use crate::{git, utils};

use colored::Colorize;
use lrncore::path::change_work_dir;
Expand All @@ -8,6 +8,7 @@ use throbber::Throbber;
/// Check if there's a new version of nyx and if so update the current one
pub fn upgrade_bin() {
change_work_dir(&utils::env::get_nyx_env_var());
git::git_pull();
let nyx_art = utils::nyx_ascii_art();
// throbber
let mut building_throbber = Throbber::new()
Expand Down