_install_yazi


"/home/yossef/notes/git/scripts/_install_yazi.md"

path: git/scripts/_install_yazi.md

- **fileName**: _install_yazi
- **Created on**: 2025-04-03 17:51:10

_install_url: https:/yazi-rs.github.io/docs/installation/

my main script for install yazi using cargo

#!/usr/bin/env bash

: << 'END'
for more information about the installation
_install_url: https://yazi-rs.github.io/docs/installation/
END

_install() {
    if _commend_exists rustc; then # check for rust is install or not
        cecho  "rustc is instelled" green
    elif _commend_exists cargo; then # check for cargo install
        cecho  "cargo is instelled" green
    else
        # starting install cargo and rust
        cecho "starting install rustc and cargo" blue

        curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
        if [[ $? != 0 ]]; then # check for error if happend
            cecho "error happend in setup rust" red
            exit 1
        fi
        rustup update # udpate the repo for rust
        if [[ $? != 0 ]]; then
            cecho "error happend in update rustup" red
            exit 1
        fi
    fi 

    if _commend_exists yazi; then # check if yazi is installed
        cecho "yazi is already installed" green
        exit 1
    fi

    # starting install yazi
    cecho "starting to install yazi using cargo" blue
    cargo install --locked yazi-fm yazi-cli
    if [[ $? != 0 ]]; then # if error happend in install
        cecho "error happend in install yazi" red
        exit 1
    fi

    # finsih installing
    cecho "install yazi successfully" green
    cecho "finish installing" green
}
_install

references: