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> --- docs/docs/guide/installation.md | 11 +++++ install.sh | 91 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 95 insertions(+), 7 deletions(-) diff --git a/docs/docs/guide/installation.md b/docs/docs/guide/installation.md index aeb33518..193b9ffa 100644 --- a/docs/docs/guide/installation.md +++ b/docs/docs/guide/installation.md @@ -16,6 +16,17 @@ then the manual steps below offer much more flexibility. curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh ``` +The install script will walk you through importing your shell history and setting +up a sync account. To skip these interactive prompts (e.g. in CI or +Dockerfiles), pass `--non-interactive`: + +```shell +curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh -s -- --non-interactive +``` + +The script also automatically detects non-interactive environments (piped input, +no TTY) and skips the prompts in those cases. + [**Set up sync** - Move on to the next step, or read on to manually install Atuin instead.](sync.md) ### On Windows 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