From 10ea7c3a65c39b5a37d46a270b08b8da149f83dc Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 3 Mar 2026 17:10:55 +0100 Subject: feat: update script for smoother setup (#3230) Many users do not seem to read the docs. So, make the install script handle most of the things that we include in the docs quickstart. Ensures that the install script still functions as expected in non-interactive environments - setup scripts, ci, etc. Offers a flag just in case this check fails, to force non-interactive setup. ## Checks - [ ] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [ ] I have checked that there are no existing pull requests for the same thing --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- install.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 7 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index 2372d23f..7962f2b5 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,23 @@ #! /bin/sh set -eu +ATUIN_NON_INTERACTIVE="no" + +for arg in "$@"; do + case "$arg" in + --non-interactive) ATUIN_NON_INTERACTIVE="yes" ;; + *) ;; + esac +done + +if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then + if [ -t 0 ] || [ -c /dev/tty ]; then + ATUIN_NON_INTERACTIVE="no" + else + ATUIN_NON_INTERACTIVE="yes" + fi +fi + cat << EOF _______ _______ __ __ ___ __ _ | _ || || | | || | | | | | @@ -48,7 +65,7 @@ fi # shellcheck disable=SC2016 if ! grep -q "atuin init bash" ~/.bashrc; then - curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh + curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh printf '\n[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh\n' >> ~/.bashrc echo 'eval "$(atuin init bash)"' >> ~/.bashrc fi @@ -69,9 +86,71 @@ end/' "$HOME/.config/fish/config.fish" fi fi -cat << EOF +ATUIN_BIN="$HOME/.atuin/bin/atuin" + +echo "" +echo "Atuin installed successfully!" +echo "" + +if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then + + printf "Would you like to import your existing shell history into Atuin? [Y/n] " + read -r import_answer