Skip to content

Commit

Permalink
Fix re-install
Browse files Browse the repository at this point in the history
  • Loading branch information
lasantosr authored Mar 20, 2023
1 parent 33d7aa1 commit ccdcbdc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown -R $USERNAME:$USERNAME /usr/local/cargo \
&& chown -R $USERNAME:$USERNAME /usr/local/rustup
&& chown -R $USERNAME:$USERNAME /usr/local/rustup \
&& chsh -s /bin/bash $USERNAME
USER $USERNAME

# Source artifact to be ready to execute
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ You can customize key bindings using environment variables: `INTELLI_SEARCH_HOTK

## Wishlist

- [ ] Option to auto-update to latest version
- [ ] Labels support to store most used labels and select them using a dedicated UI
- [ ] Pull / Push user bookmarks using some public / private Git repo
- [ ] Support for more terminals, like PowerShell
Expand Down
35 changes: 20 additions & 15 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
set -e
set -eo pipefail

# Retrieve default shell
shell="${SHELL##*/}"

if [[ "$shell" != "bash" ]] && [[ "$shell" != "zsh" ]];
if [[ "$shell" != 'bash' ]] && [[ "$shell" != 'zsh' ]];
then
echo "Terminal $shell is not compatible";
exit 1;
Expand All @@ -13,14 +13,14 @@ fi
arch=$(uname -m)
case "$OSTYPE" in
linux*) os="unknown-$OSTYPE"
INTELLI_HOME="$HOME/.local/share/intelli-shell"
INTELLI_HOME="${INTELLI_HOME:-$HOME/.local/share/intelli-shell}"
;;
darwin*) os="apple-darwin"
INTELLI_HOME="$HOME/Library/Application Support/org.IntelliShell.Intelli-Shell"
INTELLI_HOME="${INTELLI_HOME:-$HOME/Library/Application Support/org.IntelliShell.Intelli-Shell}"
;;
msys*) os="pc-windows-msvc"
POSIX_APPDATA=$(echo "/$APPDATA" | sed 's/\\/\//g' | sed 's/://')
INTELLI_HOME="$POSIX_APPDATA/IntelliShell/Intelli-Shell"
INTELLI_HOME="${INTELLI_HOME:-$POSIX_APPDATA/IntelliShell/Intelli-Shell}"
;;
*) echo "OS type not supported: $OSTYPE"
exit 1
Expand All @@ -32,20 +32,25 @@ target="$arch-$os"
mkdir -p $INTELLI_HOME/bin
curl -Lsf https://github.com/lasantosr/intelli-shell/releases/latest/download/intelli-shell-$target.tar.gz | tar zxf - -C $INTELLI_HOME/bin

echo "Successfully installed IntelliShell at: $INTELLI_HOME"

# Update rc
if [[ "$os" = "apple-darwin" ]] && [[ "$shell" = "bash" ]];
if [[ "$os" = 'apple-darwin' ]] && [[ "$shell" = 'bash' ]];
then
rcfile=".bash_profile"
else
rcfile=".${shell}rc"
fi
echo -e '\n# IntelliShell' >> ~/$rcfile
echo "INTELLI_HOME=$INTELLI_HOME" >> ~/$rcfile
echo '# export INTELLI_SEARCH_HOTKEY=\C-@' >> ~/$rcfile
echo '# export INTELLI_SAVE_HOTKEY=C-b' >> ~/$rcfile
echo '# export INTELLI_SKIP_ESC_BIND=0' >> ~/$rcfile
echo 'alias intelli-shell="$INTELLI_HOME/bin/intelli-shell"' >> ~/$rcfile
echo 'source $INTELLI_HOME/bin/intelli-shell.sh' >> ~/$rcfile
sourced=$(cat ~/$rcfile | { grep -E '^source.*intelli-shell\.sh' || test $? = 1; })
if [[ -z "$sourced" ]];
then
echo -e '\n# IntelliShell' >> ~/$rcfile
echo "INTELLI_HOME=$INTELLI_HOME" >> ~/$rcfile
echo '# export INTELLI_SEARCH_HOTKEY=\C-@' >> ~/$rcfile
echo '# export INTELLI_SAVE_HOTKEY=C-b' >> ~/$rcfile
echo '# export INTELLI_SKIP_ESC_BIND=0' >> ~/$rcfile
echo 'alias intelli-shell="$INTELLI_HOME/bin/intelli-shell"' >> ~/$rcfile
echo 'source $INTELLI_HOME/bin/intelli-shell.sh' >> ~/$rcfile

echo "Successfully installed IntelliShell at: $INTELLI_HOME"
echo "Please restart the terminal or re-source ~/$rcfile, where further customizations can be made"
echo "Please restart the terminal or re-source ~/$rcfile, where further customizations can be made"
fi

0 comments on commit ccdcbdc

Please sign in to comment.