Skip to content

Commit 5ac1ee9

Browse files
authored
feat: add get remote version option (#18)
* feat: add get remote version option * refactor: improve code, show stable and latest plus installed * fix: correct usage option * refactor: remove unused variable * fix: DOH! * feat: add short option for update
1 parent fbdb843 commit 5ac1ee9

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

cursor.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,30 @@ function get_version() {
332332
fi
333333
}
334334

335+
function check_cursor_versions() {
336+
local stable_info=$(get_download_info "stable")
337+
local stable_version=$(echo "$stable_info" | grep "VERSION=" | sed 's/^VERSION=//')
338+
local latest_info=$(get_download_info "latest")
339+
local latest_version=$(echo "$latest_info" | grep "VERSION=" | sed 's/^VERSION=//')
340+
echo "Stable Version: $stable_version"
341+
echo "Latest Version: $latest_version"
342+
echo "--------------------------------"
343+
get_version
344+
return 0
345+
}
346+
335347
# Parse command-line arguments
336348
if [ "$1" == "--version" ] || [ "$1" == "-v" ]; then
337349
get_version
338350
exit $?
339-
elif [ "$1" == "--update" ]; then
351+
elif [ "$1" == "--check" ] || [ "$1" == "-c" ]; then
352+
check_cursor_versions
353+
elif [ "$1" == "--update" ] || [ "$1" == "-u" ]; then
340354
update_cursor "$2"
341355
elif [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
342-
echo "Usage: cursor [--update <stable|latest> | --version]"
343-
echo " --update: Update Cursor to the specified version"
356+
echo "Usage: cursor [--check | --update <stable|latest> | --version]"
357+
echo " --check, -c: Show the stable and latest version of Cursor available for download"
358+
echo " --update, -u: Update Cursor to the specified version"
344359
echo " --version, -v: Show the installed version of Cursor"
345360
exit 0
346361
else

0 commit comments

Comments
 (0)