Updated ncli to represet generations with colors.
This commit is contained in:
@ -20,6 +20,9 @@ in
|
||||
|
||||
read -r -a BACKUP_FILES <<< "$BACKUP_FILES_STR"
|
||||
|
||||
# --- Read Colors file ---
|
||||
source /$HOME/$PROJECT/other/colors.sh
|
||||
|
||||
# --- Helper Functions ---
|
||||
print_help() {
|
||||
echo "NixOS CLI Utility -- version $VERSION"
|
||||
@ -127,7 +130,7 @@ in
|
||||
rebuild)
|
||||
handle_backups
|
||||
geno=$(sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | grep current | awk '{print $1}')
|
||||
echo "Starting NixOS rebuild for current host: $HOST on generation: $geno"
|
||||
echo -e "Starting NixOS rebuild for current host: $HOST on generation: $YELLOW$geno$NOCOLOR"
|
||||
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; exit 1; }
|
||||
|
||||
current=""
|
||||
@ -145,7 +148,7 @@ in
|
||||
fi
|
||||
|
||||
genn=$(sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | grep current | awk '{print $1}')
|
||||
echo "Running on new generation: $geno -> $genn"
|
||||
echo -e "Running on new generation: $YELLOW $geno $NOCOLOR-> $GREEN$genn$NOCOLOR"
|
||||
|
||||
else
|
||||
echo "✗ Rebuild failed for $HOST" >&2
|
||||
@ -155,7 +158,7 @@ in
|
||||
update)
|
||||
handle_backups
|
||||
geno=$(sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | grep current | awk '{print $1}')
|
||||
echo "Updating flake and rebuilding system for current host: $HOST on generation: $geno"
|
||||
echo -e "Updating flake and rebuilding system for current host: $HOST on generation: $YELLOW$geno$NOCOLOR"
|
||||
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; exit 1; }
|
||||
|
||||
echo "Updating flake..."
|
||||
@ -188,7 +191,7 @@ in
|
||||
fi
|
||||
|
||||
genn=$(sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | grep current | awk '{print $1}')
|
||||
echo "Running on new generation: $geno -> $genn"
|
||||
echo -e "Running on new generation: $YELLOW $geno $NOCOLOR-> $GREEN$genn$NOCOLOR"
|
||||
|
||||
else
|
||||
echo "✗ Update and rebuild failed for $HOST" >&2
|
||||
@ -260,7 +263,7 @@ in
|
||||
;;
|
||||
trim)
|
||||
echo "Running 'sudo fstrim -v /' may take a few minutes and impact system performance."
|
||||
read -p "Enter (y/Y) to run now or enter to exit (y/N): " -n 1 -r
|
||||
read -p "Enter to run now or enter to exit (y/N): " -n 1 -r
|
||||
echo # move to a new line
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Running fstrim..."
|
||||
|
||||
Reference in New Issue
Block a user