Last active
November 4, 2020 17:28
-
-
Save antibagr/8bb60a50da7c71556b8b4b1cd9f1983c to your computer and use it in GitHub Desktop.
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
@echo off | |
:: ======================================== | |
:: Small script to automate load developer environment on Windows | |
:: Open it from cmd. it will change directory, load virtual environment and open your IDE automatically. | |
:: Launch it and it will list folders in "YOUR_PROJECTS_FOLDER" | |
:: Then enter a folder you wish to open. | |
:: Program will close if you enter one of exit keyword | |
:: ======================================== | |
:: TO CONFIGURE THIS FILE | |
:: REPLACE "YOUR_PROJECTS_FOLDER" WITH YOUR ACTUAL PROJECTS PATH | |
:: WHICH CONTAINS EVERY PROJECT IN ITS OWN FOLDER. | |
:: THEN YOU CAN REPLACE "atom" AT LINE 87 WITH ANY IDE YOU WORKING WITH. | |
:: Made for make life simplier by Rudolf Nemov | |
:: https://github.com/antibagr | |
set path_to_projects=%YOUR_PROJECTS_FOLDER% | |
:: YOUR_PROJECTS_FOLDER\ | |
:: PROJECT_FOLDER1\ | |
:: PROJECT_FOLDER2\ | |
:: ... | |
:FunctionSelectProject | |
:: Show projects list | |
dir /a:d /b %path_to_projects% | |
:: Ask to enter project title. No tab autocomplete | |
set /p selected_project=">>> ": | |
:: Break the loop if user enters exit keyword | |
for %%A in ("exit" "close" "undo" "^Z") do if "%selected_project%"==%%A goto FunctionExit | |
if not exist %path_to_projects%\%selected_project% ( | |
:: No such project, repeat | |
cls | |
echo No such project & echo. | |
GOTO FunctionSelectProject | |
) else ( | |
goto FunctionOpenProject | |
) | |
:FunctionOpenProject | |
echo opening project %selected_project% | |
set running_project=%path_to_projects%\%selected_project% | |
D: | |
cd %running_project% | |
if exist %running_project%\venv ( | |
echo Activate virtual environment ... | |
CALL venv\Scripts\activate.bat > NUL | |
) | |
cls | |
:: Show git status | |
echo. & echo. & echo Project %selected_project% & echo. | |
if exist .git ( git status -s -b ) | |
echo. & echo. | |
:: Open project in an explorer | |
explorer %CD% | |
:: Open user's IDE. Currently is's an atom. | |
atom . | |
goto EOF | |
:FunctionExit | |
cls | |
C: | |
:EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment