多種開發語言專案管理工具 發表於 2022-11-16 | 更新於 2023-08-01
需求 全端工程師常常會同時需要用多種語言進行專案開發,使用各種語言適合的IDE(例如Xcode、Android Studio、PyCharm、GoLand、AppCode)進行專案開啟。若對要修改較舊專案,常常會須再花時間去找專案的位置。
如果可以透過指令找到專案並開啟對應的IDE,就能節省很多時間。
從上面問題歸納幾點需求:
透過指令列出過去做的專案,以及可透過關鍵字進行搜尋。
可以指定每個專案開啟的IDE。
能有個區塊可以輸入過去做的專案資訊。
使用指令 透過Bash語言實作。 指令:
列出所有專案,llprojects
或lp
。
用關鍵字搜尋專案,llprojects cloud
或lp cloud
。
輸入llprojects
指令,列出所有專案。 單列結構:p6---私人綜合服務 kevin_mycloud__python ~/icloud/Code/cek/mycloud
p6: 專案編號,也是簡短指令,輸入p6指令可開啟此專案。
私人綜合服務: 專案簡短描述。
kevin_mycloud__python: 專案代號,也是長指令,輸入kevin_mycloud__python指令可開啟此專案。
~/icloud/Code/cek/mycloud: 專案路徑。
輸入llprojects cloud
指令,搜尋有cloud
關鍵字的專案。
輸入kevin_mycloud__python
或p6
指令,用pycharm IDE開啟專案。
指令實作 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 ide_open (){ cd $2 VSCODE_CWD="$2 " open -a "$1 " "$2 " ; } goland (){ ide_open "/Applications/GoLand.app/" $1 } py (){ ide_open "/Applications/PyCharm.app/" $1 } phpstorm (){ ide_open "/Applications/PhpStorm.app/" $1 } android (){ ide_open /Applications/Android\ Studio.app $1 } clion (){ ide_open "/Applications/CLion.app/" $1 } vscode (){ cd $1 VSCODE_CWD="$1 " open -n -b "com.microsoft.VSCode" --args $1 ; } xcode (){ ide_open "/Applications/Xcode.app/" $1 } my_projects=( '設定檔案' 'kevin_profile__golang= ~/.profile #環境變數自訂' 'kevin_profiles__golang= ~/.profiles #環境變數自訂' 'Kevin娛樂專案' 'kevin_voicetube_mp3_download__php= ~/icloud/Code/cek/downloadVoiceTubeMp3 #VoiceTube MP3下載程式' 'kevin_fxcm__python= ~/icloud/Code/cek/fxcm #MT4外匯分析+SVM+高鐵自動搶票程式' 'kevin_fb_scraper__python= ~/icloud/Code/cek/fb_scraper #臉書爬蟲' 'kevin_tw_stock__python= ~/icloud/Code/cek/tw_stock #股票+protop_airtag' 'kevin_leetcode__python= ~/icloud/Code/cek/leetcode #Leetcode練習' '魚塭IOT專案' 'kevin_fishiot__android= ~/icloud/Code/cek/fishiot/android/FishIot #電源監測Android' 'kevin_fishiotswitch__android= ~/icloud/Code/cek/fishiot/android/FishIotSwitch #電源開關Android' 'kevin_rtsp_to_img__golang= ~/icloud/Code/cek/fishiot/rtsp_to_img_server #rtsp轉圖片服務器' 'kevin_fishiot__python= ~/icloud/Code/cek/fishiot #esp32電源監測程式' 'kevin_fishiotAP__python= ~/Code/nodemcu/fish #esp8266 AP裝置程式' 'kevin_fishiot_cloud__python= ~/icloud/Code/cek/fishiot/backend #後端' 'kevin_fishiot_single__golang= ~/icloud/Code/cek/fishiot/backend_single #臨時電源監控系統' 'kevin_repeator_ardunio__clion= ~/icloud/Code/cek/fishiot/ardunio/esp8266 #repeator test ardunio' 'kevin_fishiot_mesh__clion= ~/icloud/Code/cek/fishiot/ardunio/esp8266 #wifi mesh' ) llprojects (){ RED='\033[0;31m' GREEN='\033[0;32m' Orange='\033[0;33m' White='\033[1;37m' NC='\033[0m' out="" i=1 for index in "${my_projects[@]} " ; do KEY="${index%%=*} " VALUE="${index##*=} " PATH2="${VALUE%%#*} " COMMENT="${VALUE##*#} " if [[ $KEY == $COMMENT ]]; then out="$out \n${GREEN} $KEY${NC} " continue fi if [ -z "$1 " ];then true elif [[ $KEY == *"$1 " * ]]; then true else i=$((i + 1 )) continue fi out="$out \np${i} ---${RED} $COMMENT${NC} ,${Orange} $KEY${NC} ,$PATH2 " i=$((i + 1 )) done echo -e "$out " | column -t -s ',' } alias_ide (){ i=1 for index in "${my_projects[@]} " ; do KEY="${index%%=*} " VALUE="${index##*=} " VALUE2="${VALUE%%#*} " COMMENT="${VALUE##*#} " if [[ $KEY == $COMMENT ]]; then continue fi alias "${KEY} __vscode" ="vscode $VALUE " alias "${KEY} __goland" ="goland $VALUE " alias "${KEY} __py" ="py $VALUE " alias "${KEY} __phpstorm" ="phpstorm $VALUE " alias "${KEY} __android" ="android $VALUE " alias "${KEY} __xcode" ="xcode $VALUE " alias "${KEY} __clion" ="clion $VALUE " if [[ "${KEY##*__} " == "vscode" ]]; then alias "$KEY " ="vscode $VALUE " fi if [[ "${KEY##*__} " == "golang" ]]; then alias "$KEY " ="goland $VALUE " fi if [[ "${KEY##*__} " == "python" ]]; then alias "$KEY " ="py $VALUE " fi if [[ "${KEY##*__} " == "php" ]]; then alias "$KEY " ="phpstorm $VALUE " fi if [[ "${KEY##*__} " == "android" ]]; then alias "$KEY " ="android $VALUE " fi if [[ "${KEY##*__} " == "xcode" ]]; then alias "$KEY " ="xcode $VALUE " fi if [[ "${KEY##*__} " == "clion" ]]; then alias "$KEY " ="clion $VALUE " fi alias "p$i " ="$KEY " alias "p${i} open" ="open $VALUE " i=$((i + 1 )) done } alias_ide alias lp="llprojects"
Keyword 1 2 3 歸納, summarize, sum-ma-rize 實作, implement, im-ple-ment 多種語言, multi language, mul-ti lang-gu-age