A command-line tool to quickly navigate to your development projects and automatically execute predefined commands.
- Features
- Project Structure
- Installation
- Configuration
- Usage
- Troubleshooting
- Uninstallation
- Technical Information
- Version History
- Contributing
- License
- π Quick navigation to your projects
- π Persistent directory changes in the shell
- π Automatic Git pull of latest changes
- π» Automatic execution of custom commands
- π₯οΈ Automatic opening in VS Code
- βοΈ Flexible JSON configuration
GoToProjects/
βββ go_to_project.py # Main Python script
βββ gtp # Shell wrapper script
βββ install.sh # Installation script
βββ config.json # Project configuration
βββ config_example.json # Configuration example
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Clone or download this repository
git clone https://github.com/VivicatcHub/GoToProjects.git
cd GoToProjects- Run the installation script (requires sudo):
sudo ./install.sh- The script will:
- Verify that all necessary files exist
- Create a
gtpscript with integrated absolute paths - Install it to
/usr/bin/gtp - Make the binary accessible from anywhere
If you prefer to use the tool without system installation:
# From the GoToProjects directory
source ./gtp <project_name>This method doesn't require root privileges but only works from the project directory.
- Copy the example file:
cp config_example.json config.json- Edit
config.jsonaccording to your projects:
{
"my-project": {
"path": "/home/user/Projects/my-project/",
"vscode": true,
"pull": true,
"commands": ["npm install", "npm run dev"]
},
"another-project": {
"path": "/home/user/Work/another-project/",
"vscode": false,
"pull": false,
"commands": ["docker-compose up -d", "echo 'Project started!'"]
}
}For each project, you can define:
path(required): Absolute path to the project directoryvscode(optional):trueto automatically open VS Codepull(optional):trueto automatically executegit pullcommands(optional): List of commands to execute in order
Simply use the gtp command from anywhere:
gtp <project-name>From the GoToProjects directory:
source ./gtp <project-name># Go to project "wow"
gtp wow
# The script will:
# 1. Navigate to /incredible/wow
# 2. Execute git pull (if pull: true)
# 3. Execute all defined commands in order
# 4. Open VS Code (if vscode: true)Problem: After running gtp, you're still in the original directory.
Solutions:
- β
Use
gtp <project>after system installation - β
Use
source ./gtp <project>for local usage - β Never use
./gtp <project>(runs in a subshell)
The script suggests similar projects based on the first letter:
$ gtp ma
β Project 'ma' not found.
π Available projects: marin-kitagawaVerify that:
- The path in
config.jsonis correct - You have permissions to access the directory
- The directory exists
Problem: Message "β No script generated for project 'X'"
Possible causes:
- The project doesn't exist in
config.json - Error in the Python script
- Insufficient permissions to write to
/tmp/
Solution: Verify that the project exists and that the config.json file is valid.
To remove gtp from the system:
sudo rm /usr/bin/gtp-
go_to_project.py: Main Python script that:- Reads the JSON configuration
- Generates a temporary shell script with commands
- Places the script in
/tmp/gtp_<project_name>.sh
-
gtp: Shell wrapper script that:- Calls the Python script
- Sources the generated temporary script
- Cleans up the temporary file
-
install.sh: Installation script that:- Creates a version of
gtpwith absolute paths - Installs it to
/usr/bin/
- Creates a version of
Temporary scripts are created in /tmp/gtp_<project_name>.sh and automatically deleted after use.
- β Case-insensitive project names
- β
New
listcommand to display all available projects - β Improved project search with beginning character filtering
- β Better error handling and messages
- β Fix error when project name is not provided
- β
Support for the
never_askoption to execute commands without confirmation - β Integrated confirmation prompt in the generated bash script (zsh compatible)
- β
System installation in
/usr/bin/ - β Improved error handling
- β Automatic cleanup of temporary files
- β Initial release with zsh function
- β Project support via JSON
- β Custom commands
This project is open source. Feel free to use, modify, and distribute it according to your needs.
