diff --git a/neovim.sh b/neovim.sh index 31a864a..9727b6e 100644 --- a/neovim.sh +++ b/neovim.sh @@ -36,6 +36,27 @@ source-script "https://git.k4li.de/pika/beddu/raw/branch/main/dist/beddu.sh" } + # command for executing silent mode only when nessessairy + # ex: _run "Building $PACKAGE" _install neovim + _run() { + local msg=$1 + local cmd="${@:1}" + local err out + + if $silent; then + spin "$msg" + if run --err err --out out "$cmd"; then + check "Done!" + else + trow "OUTPUT: ${out:-}" + trow "ERROR_OUTPUT: ${err:-}" + fi + else + echo_pkg "$msg" + "$cmd" + fi + } + getDependencies() { echo_pkg deps "Checking build dependencies, and installs missing.." @@ -80,7 +101,7 @@ if command_exists git; then sleep 1 - if $_run git clone --depth=1 https://github.com/neovim/neovim.git; then + if _run git clone --depth=1 https://github.com/neovim/neovim.git; then check green "Cloned $PACKAGE sources" line @@ -101,7 +122,7 @@ line # echo_pkg build "Compiling neovim from source" spin "Compiling neovim from source" - if $_run make CMAKE_BUILD_TYPE=RelWithDebInfo; then + if _run make CMAKE_BUILD_TYPE=RelWithDebInfo; then check "Compiled $PACKAGE from source" line echo_pkg install @@ -117,7 +138,7 @@ if [ -d "$HOME/.config/nvim/" ]; then # echo_pkg qol "Prefetching neovim setup configuration.." spin "Prefetching neovim setup configuration.." - if $_run nvim --headless +q; then + if _run nvim --headless +q; then check "Prefetched config" else throw "Prefetching config went terribly wrong!" @@ -135,8 +156,8 @@ local err out local url="https://git.k4li.de/dotfiles/nvim.git" spin yellow "Cloning pika's standard config" - # if $_run install-stuff; then - if $_run git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then + # if _run install-stuff; then + if _run git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then check "Cloned neovim config" line pen "${out:-}" @@ -146,7 +167,7 @@ fi spin bold yellow "Also sourcing config!" - if $_run nvim --headless +q; then + if _run nvim --headless +q; then check "Prefetching config was successfull" line pen "${out:-}" @@ -159,8 +180,8 @@ "pika's minimal config") local url="https://git.k4li.de/dotfiles/nvim-mini.git" spin yellow "Cloning pika's standard config" - # if $_run install-stuff; then - if $_run git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then + # if _run install-stuff; then + if _run git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then check "Cloned neovim config" line pen "${out:-}" @@ -170,7 +191,7 @@ fi spin bold yellow "Also sourcing config!" - if $_run nvim --headless +q; then + if _run nvim --headless +q; then check "Prefetching config was successfull" line pen "${out:-}"