diff --git a/README.md b/README.md index a6131c1..cec144a 100644 --- a/README.md +++ b/README.md @@ -1 +1,53 @@ -# init +# Setup Install Cursor IDE in Linux + +## How to Start + +1. Run the following command to initiate the setup process: + + ```bash + git clone https://github.com/argell10/SetupCursorIDE.git --depth=1 && cd hikari-ken/setup_cursor && ./install.sh + ``` + +2. Once the setup is complete, execute the following command based on your terminal: + + - If you are using Bash: + ```bash + source ~/.bashrc + ``` + + - If you are using Zsh: + ```bash + source ~/.zshrc + ``` + +## About Cursor IDE + +This project simplifies the process of installing Cursor as a desktop executable application on Linux. It enables you to use Cursor anywhere in your terminal, similar to the `code .` command for Visual Studio Code. + +### What is Cursor IDE? + +Cursor IDE is an open-source code editor based on Visual Studio Code and integrated with ChatGPT. Learn more about this project [here](link). + +## How to Use Cursor + +After completing the setup, you can use the `cursor` command to launch Cursor IDE. For example: + +```bash +cursor . +``` + +> **Note:** the `cursor .` to open cursor IDE in a folder spesific `cursor` to only open the cursor IDE + +
+ +

+ + Cursor + + + Linux and Bash icons + + + Dev.to icon + +

diff --git a/assets/icon.svg b/assets/icon.svg new file mode 100644 index 0000000..f316524 --- /dev/null +++ b/assets/icon.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/logo.svg b/assets/logo.svg new file mode 100644 index 0000000..6d97055 --- /dev/null +++ b/assets/logo.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..b0bbd22 --- /dev/null +++ b/install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +readonly REPO_DIR="$(dirname "$(readlink -m "${0}")")" +readonly TEMP_DIR="${REPO_DIR}/templates" + +# Source the color and function variables +source "${REPO_DIR}/shell/vars.sh" +source "${REPO_DIR}/shell/functions.sh" + + +# Download cursor +echo -e "\n${BLUE_DARK}Installing cursor...${NC}" +download_cursor + +# Agregar cursor al PATH en el archivo de configuración apropiado +echo -e "\n${BLUE_DARK}Define comand line cursor...${NC}" +add_cursor_alias + +# Set up cursor +echo -e "\n${CYAN}Config cursor...${NC}" +setup_cursor + +remove_files diff --git a/shell/functions.sh b/shell/functions.sh new file mode 100755 index 0000000..adc87bd --- /dev/null +++ b/shell/functions.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +function add_cursor_alias() { + # Determine the user's shell + local SHELL_NAME=$(basename "$SHELL") + + # Set the appropriate configuration file + local CONFIG_PATH + if [ "$SHELL_NAME" = "bash" ]; then + CONFIG_PATH="$HOME/.bashrc" + elif [ "$SHELL_NAME" = "zsh" ]; then + CONFIG_PATH="$HOME/.zshrc" + else + echo "Unable to determine the current shell." + return 1 + fi + + # Add alias with "&" to run in the background + echo 'alias cursor="/opt/cursor/cursor.AppImage > /dev/null 2>&1 &"' >> "$CONFIG_PATH" + echo "✅ Added alias 'cursor' to $CONFIG_PATH" +} + +function download_cursor() { + # Create the output directory if it doesn't exist + mkdir -p "$OUTPUT_DIRECTORY" + + # Download cursor if it doesn't exist + if [ -e "$OUTPUT_FILE" ]; then + echo -e "${GREEN}✅ The file already exists: $OUTPUT_FILE${NC}" + else + echo -e "↓ ${CYAN}Downloading cursor... ${DOWNLOAD_EMOJI}${NC}" + curl -o "$OUTPUT_FILE" "$URL_CURSOR_DOWN" + if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ Download completed: $OUTPUT_FILE${NC}" + else + echo -e "${RED}❌ Error during download${NC}" + exit 1 + fi + fi + +} + + +function setup_cursor() { + local CURRENT_DIRECTORY=$(pwd) + local DESKTOP_FILE="/usr/share/applications/cursor.desktop" + + # Set up cursor: move, grant permissions, and create .desktop file + sudo mkdir -p /opt/cursor + sudo cp -r "$CURRENT_DIRECTORY/assets" /opt/cursor/ + sudo mv "$OUTPUT_FILE" /opt/cursor/ + if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ File $OUTPUT_FILE moved successfully to /opt/cursor/${NC}" + else + echo -e "${RED}❌ Error moving the file${NC}" + exit 1 + fi + sudo chmod +x /opt/cursor/cursor.AppImage + sudo chown $USER:$USER /opt/cursor + if [ $? -eq 0 ]; then + echo -e "${GREEN}✅ Permissions granted successfully to /opt/cursor/cursor.AppImage${NC}" + else + echo -e "${RED}❌ Error granting permissions${NC}" + exit 1 + fi + # Create .desktop file + sudo tee "$DESKTOP_FILE" > /dev/null <