File tree Expand file tree Collapse file tree
.oh-my-shell/shellrc/plugins/development Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,3 +9,7 @@ alias tcode="cd \"${_DEFAULT_DEVELOPMENT_DIR}/\$(find ${_DEFAULT_DEVELOPMENT_DIR
99# Create workspace
1010# Usage: code_create_company_workspace_project "company_name" "workspace_name" "project_name"
1111alias code_create_workspace=" f_code_create_workspace ${_DEFAULT_DEVELOPMENT_DIR} "
12+
13+ # Delete a workspace
14+ # Usage: workspace_delete
15+ alias code_wipe_workspace=" f_code_wipe_workspace ${_DEFAULT_DEVELOPMENT_DIR} "
Original file line number Diff line number Diff line change 1- function f_code_create_company_workspace_project() {
1+ f_code_create_company_workspace_project () {
22 local code_dir=" $1 "
33 local company=" $( echo $2 | tr ' [:lower:]' ' [:upper:]' ) "
44 local workspace=" $( echo $3 | tr ' [:lower:]' ' [:upper:]' ) _WORKSPACE"
55 local project=" $( echo $4 | tr ' [:lower:]' ' [:upper:]' ) "
66
77 mkdir -p " ${code_dir} /$company /$workspace /$project "
88}
9+
10+ # POSIX-compatible script to delete everything below folders
11+ # ending with *_WORKSPACE
12+ f_code_wipe_workspace () {
13+ # Starting directory (default: current directory)
14+ local start_dir=" $1 "
15+
16+ start_dir=" $( realpath " $start_dir " ) "
17+
18+ # Find matching directories
19+ workspace_dir=" $( find " $start_dir " -maxdepth 1 -type d -name ' *_WORKSPACE' -printf ' %P\n' | fzf) "
20+
21+ echo " Confirm wiping $workspace_dir ? [y/n]"
22+ workspace_dir=" $start_dir /$workspace_dir "
23+ read answer
24+
25+ case " $answer " in
26+ [Yy])
27+ command rm -rf " $workspace_dir "
28+ ;;
29+ * )
30+ echo " Aborted."
31+ ;;
32+ esac
33+ }
34+
You can’t perform that action at this time.
0 commit comments