Created
January 23, 2025 09:12
-
-
Save paulojeronimo/2096b95e31340d0732fbd466883f07ac to your computer and use it in GitHub Desktop.
Cursor start script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -eou pipefail | |
| cursor_dir=${cursor_dir:-~/Downloads} | |
| cursor_prefix=cursor- | |
| cursor_suffix=.AppImage | |
| cursor_files=($(echo $cursor_dir/$cursor_prefix*$cursor_suffix)) | |
| log() { | |
| local level=${level:-INFO} | |
| local ts=$(date +%c) | |
| local cursor_log=${cursor_log:-~/.cursor/cursor.log} | |
| echo "[$level] $ts" - "$@" | tee -a $cursor_log | |
| } | |
| ! [[ ${#cursor_files[@]} -gt 1 ]] || { | |
| echo Multiple Cursor versions found in $cursor_dir! | |
| echo Move the old Cursor versions to another directory to continue ... | |
| exit 1 | |
| } | |
| cursor_file=${cursor_files[0]} | |
| cursor_version=${cursor_file#$cursor_dir/$cursor_prefix} | |
| cursor_version=${cursor_version%$cursor_suffix} | |
| mkdir -p ~/.cursor | |
| cursor_log=~/.cursor/$cursor_version.log | |
| cursor_args="$@" | |
| echo Cursor Log file: $cursor_log | |
| log Starting Cursor $cursor_version with \"$cursor_args\" arguments ... | |
| [ -f $cursor_file ] || { | |
| level=ERROR log File $cursor_file not found! | |
| exit 1 | |
| } | |
| [ -x $cursor_file ] || chmod +x $cursor_file | |
| nohup setsid $cursor_file --no-sandbox "$cursor_args" &>> $cursor_log & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment