Skip to content

Instantly share code, notes, and snippets.

@dberstein
Last active December 23, 2022 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dberstein/e0cd36edf54104b535491881b5a59bca to your computer and use it in GitHub Desktop.
Save dberstein/e0cd36edf54104b535491881b5a59bca to your computer and use it in GitHub Desktop.
CLI background launcher of IntelliJ using aliases for toolbox scripts
#!/bin/sh
# Locate tool whose basename matches ours in toolbox's scripts directory
# ie. ln -s [$HOME/.local/bin/]intellij.sh [$HOME/.local/bin/]clion
# ensure "$HOME/.local/bin" in PATH is *before* toolbox's path ($HOME/.local/share/JetBrains/Toolbox/scripts),
# that way invoking "clion" invokes intellij.sh and it invokes toolbox's in CLI's background.
declare TOOL="$( find "$HOME/.local/share/JetBrains/Toolbox/scripts" -mindepth 1 -maxdepth 1 -type f \
-name "$(basename $0)" -executable -exec readlink -f {} \; )"
# No tool found is an error ...
if [ -z "$TOOL" ]; then
echo "Error, not an executable file:" $(basename $0)
exit 1
fi
# Background launch tool ...
$TOOL $@ &>/dev/null &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment