#!/bin/bash
# - bof - #



<<'comment'
# -  - #
# - Install Eza - #

xdg-user-dirs-update;
sudo apt install dialog duf curl figlet git lolcat neovim openssh-server pv webapp-manager -y;
sudo apt install dialog duf curl figlet git htop inxi lolcat net-tools neovim openssh-server pv webapp-manager -y;

bash <(curl -s https://www.education.isdevelopment.us/Eza/Eza.sh)

# -  - #
# - Timezone setting - #
sudo timedatectl set-timezone America/New_York;
timedatectl;



cd ~/; rm -rf ~/Eza.sh; vim ~/Eza.sh;
vim ~/Eza.sh;
chmod +x ~/Eza.sh; ~/./Eza.sh;



# -  - #
# - Documentation - #
https://eza.rocks/

https://linuxtldr.com/installing-eza/
https://linuxiac.com/eza-command-listing-files-in-linux/



# -  - #
# - Samples - #

# The ubiquitous 'll': directories first, with alphanumeric sorting:

alias ls='eza --icons=always'
alias l='ls -lh'
alias ll='ls -lgh'
alias la='ls -lah'
alias lg='ls -lagh'
alias ld='ls -lDh'
alias lad='ls -laDh'
alias lf='ls -lfh'
alias laf='ls -lafh'

alias lt='ls -lTg'
alias lt1='ls -lTg --level=1'
alias lt2='ls -lTg --level=2'
alias lt3='ls -lTg --level=3'
alias lta='ls -lTag'
alias lta1='ls -lTag --level=1'
alias lta2='ls -lTag --level=2'
alias lta3='ls -lTag --level=3'


# -  - #
# - Commands & descriptions - #

eza -l                          Display the entries with permissions, size, user, modified date of the file, and directory.
eza -lh                         Display the same output as the “eza -l” command but with a column header.
eza -la                         Display all the files and directories, including the hidden ones.
eza -lT                         Recursively display the file and directory content in a tree like structure.
eza --icons=always|auto|never   Display the entries with icons, but make sure to install Nerd fonts.
eza --hyperlink                 Display the entries with a clickable hyperlink.
eza --absolute                  Display the entries with an absolute (or full) path.
eza -lD                         Display only the entries of directories.
eza -ld                         Display only the entries of files.
eza -lB                         Display the file size in bytes.
eza -l --total-size             Recursively display the size of files and files inside other directories.
eza -lg                         Display the files and directories group.
eza -li                         Display the files inode number.



# -  - #
# - NerdFont - #

# -  - #
# - Documentation - #
https://medium.com/@almatins/install-nerdfont-or-any-fonts-using-the-command-line-in-debian-or-other-linux-f3067918a88c

# -  - #
# - Download JetBrainsMono NerdFonts - #
https://www.nerdfonts.com/font-downloads

# -  - #
# - Extract JetBrainsMono NerdFonts - #

# -  - #
# - Paste in terminal - #

wget -P ~/.local/share/fonts https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/JetBrainsMono.zip \
&& cd ~/.local/share/fonts \
&& unzip JetBrainsMono.zip \
&& rm JetBrainsMono.zip \
&& fc-cache -fv

# -  - #
# - Install fonts-awesome - #
sudo apt install fonts-font-awesome -y;

# -  - #
# - Restar computer so fonts take efect - #
comment



# -  - #
# - uEza_ - #
function uEza_(){
  local sFa_='fonts-font-awesome';
  echo -e "\nInstalling $sFa_ & eza...";

  echo -e "\nInstalling $sFa_...\n";
  sudo apt install eza $sFa_ unzip -y;

<<'comment'
  echo -e "\n\n\nInstalling eza...\n";
  sudo mkdir -p /etc/apt/keyrings;
  wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
  echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
  sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
  sudo apt update;
  sudo apt install eza -y;
comment

  echo -e "\n$sFa_ & eza were installed successfully...\n\n\n";
  sleep 10;
}



# -  - #
# - aEza_ - #
function aEza_(){
  local sFf_="ttf-font-awesome";
  echo -e "\nInstalling $sFf_ & eza...";

  echo -e "\nInstalling $sFf_...\n";
  sudo pacman -S $sFf_ --noconfirm --needed;

  echo -e "\n\n\nInstalling eza...\n";
  sudo pacman -S eza --noconfirm --needed;

  echo -e "\n$sFf_ & eza were installed successfully...\n\n\n";
  sleep 10;
}



# -  - #
# - fEza_ - #
function fEza_(){
  local sFa_="fontawesome-fonts-all";
  echo -e "\nInstalling $sFa_ & eza...";

  echo -e "\nInstalling $sFa_...\n";
  sudo dnf install $sFa_ -y;

  echo -e "\n\n\nInstalling eza...\n";
<<comment
  sudo dnf copr enable alternateved/eza -y;
  sudo dnf install eza -y;
comment

  sudo dnf install cargo -y;
  cd ~/Downloads;
  git clone https://github.com/eza-community/eza.git
  cd eza;
  cargo install --path .

  # - -rpv - #
  # - Copy cargo configuration to root user - #
  sudo cp -rp /home/is_derayo/.cargo /root/.cargo;
  sudo chown -R root:root /root/.cargo;

<<comment
  # -  - #
  # - Add eza to $PATH in .bashrc file - #
  export PATH="$PATH:$HOME/.cargo/bin"
comment

  echo -e "\n$sFa_ & eza were installed successfully...\n\n\n";
  sleep 10;
}



# -  - #
# - jetBrainsMono_ - #
function jetBrainsMono_(){
  local sJbm_=JetBrainsMono.zip \
        sFdir_=~/.local/share/fonts/JetBrains;
  echo -e "\nInstalling $sFdir_/$sJbm_ fonts ...\n";
  mkdir -p $sFdir_;
  cd $sFdir_;

  curl -o $sJbm_ $uWServer_/Eza/$sJbm_ \
          && unzip $sJbm_ \
          && rm -rf $sJbm_ \
          && fc-cache -fv;

  echo -e "\n$sFdir_/$sJbm_ fonts were installed successfully...\n\n\n";
  cd $Dir_;
  sleep 10;
}



# -  - #
# - basrRc_ - #
function basrRc_(){
  local sBr_='' \
        sRc_=.rc-Alias \
        sB_=.bashrc \
        sD_=/Arch.Ins/Software.Ins/Bashrc-Zshrc.Ins/;
  echo -e "\nConfiguring $sB_...";

  case $Opt in
    1 | 4 )
      sBr_='Ubuntu'
      ;;
    2 )
      sBr_='Arch'
      ;;
    3 )
      sBr_='Fedora'
      ;;
  esac

  cd ~/;
  curl -o ~/$sB_ $uWServer_$sD_$sBr_$sB_
  curl -o ~/$sRc_ $uWServer_$sD_/$sBr_$sRc_
  source $sB_;

  sudo cp $sB_ $sRc_ /root/;
  cd $Dir_;

  echo -e "\n$sB_ was configured successfully...\n\n\n";
}



# -  - #
# - installEza_ - #
function installEza_(){
  case $Opt in
    1|4)
      uEza_
      ;;
    2)
      aEza_
      ;;
    3)
      fEza_
      ;;
  esac
}



clear;

if [ "$( which eza )" != "" ]; then
  echo -e "\n\nEza is already installed...\n\n\n";
  sleep 5; exit 0;
fi;



source <(curl -s https://www.education.isdevelopment.us/Functions/Functions.sh)
distroVersion_;

update_;
installEza_;
jetBrainsMono_;
basrRc_;
rm -rf ~/Eza.sh;



echo -e "\nThe system has to reboot so changes can apply ...\n\n\n";
sleep 10;
sudo reboot now;



<<'comment'
cd ~/; rm -rf ~/Eza.sh; vim ~/Eza.sh;
vim ~/Eza.sh;
chmod +x ~/Eza.sh; ~/./Eza.sh;
comment



# - eof - #