zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.77k stars 123 forks source link

[bug]: On repo / branch checkout failure, the installation script should exit #297

Open alichtman opened 2 years ago

alichtman commented 2 years ago

Describe the bug

In this log, there is a cloning error that should have stopped the installation process entirely, but didn't. I had to rerun this command to install zinit properly.

strawman% bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
🔵INFO: About to setup zinit from zdharma-continuum/zinit (branch: main - commit: N/A) to /home/pwn/.local/share/zinit/zinit.git/zinit.git
🔵INFO: Fetching git-process-output.zsh from https://raw.githubusercontent.com/zdharma-continuum/zinit/main/share/git-process-output.zsh
✅SUCCESS: Download finished!
🔵INFO: Installing zinit to  /home/pwn/.local/share/zinit/zinit.git/zinit.git
Cloning into 'zinit.git'...
fatal: unable to access 'https://github.com/zdharma-continuum/zinit/': Could not resolve host: github.com

❌ERROR: Failed to check out branch main
❌ERROR: Failed to install Zinit to /home/pwn/.local/share/zinit/zinit.git/zinit.git
🚧WARNING: /home/pwn/.config/zsh/.zshrc already contains zinit commands. Not making any changes.
 Would you like to add 4 useful plugins - the most useful annexes (Zinit extensions that add new functions-features to the plugin manager) to the zshrc as well? It will be the following snippet:

# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
    zdharma-continuum/zinit-annex-as-monitor \
    zdharma-continuum/zinit-annex-bin-gem-node \
    zdharma-continuum/zinit-annex-patch-dl \
    zdharma-continuum/zinit-annex-rust

 Enter y/n and press Return: ^Cremoved '/tmp/tmp.az7PPvBN4L/git-process-output.zsh'
removed directory '/tmp/tmp.az7PPvBN4L'
^C^C^C^C^\
🚧WARNING: Skipped the annexes.

🌻 Welcome!

Now to get started you can check out the following:

- The README section on the ice-modifiers:
    🧊 https://github.com/zdharma-continuum/zinit#ice-modifiers
- There's also an introduction to Zinit on the wiki:
    📚 https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/
- The For-Syntax article on the wiki, which hilights some best practises:
    📖 https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/

💁 Need help?
- 💬 Get in touch with us on Gitter: https://gitter.im/zdharma-continuum
- 🔖 Or on GitHub: https://github.com/zdharma-continuum

Steps to reproduce

No consistent repro.

Expected behavior

Error cloning zinit / checking out the main branch should result in a clear installation failure message.

Screenshots and recordings

No response

Operating System & Version

u | debian | i686 | i686 | i686 unknownc

Zsh version

zsh 5.8 (i686-debian-linux-gnu)

Terminal emulator

xterm-256color

If using WSL on Windows, which version of WSL

No response

Additional context

No response

vladdoster commented 2 years ago

This script needs to be rewritten IMO to have flags and fix issues like this. I'll make this a priority for the weekend.

vladdoster commented 2 years ago

@alichtman

Currently, the script has no flags and just starts installing. This gives users no ability to see what possible options are available. Only way would be to read the source code.

Screen Shot 2022-06-04 at 04 01 07

Here is what I have currently for the rewrite. Thoughts?

Screen Shot 2022-06-04 at 04 01 31
vladdoster commented 2 years ago
Screen Shot 2022-06-04 at 04 24 36
alichtman commented 2 years ago

Rewrite UI looks great. I do feel strongly about keeping sane defaults so we can leave the "no thinking required" install process.