Last active
June 29, 2016 01:24
-
-
Save mattkenefick/8d5858abd8fe1b4e262ff97f64c60409 to your computer and use it in GitHub Desktop.
`projects` for bash
This file contains 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
## | |
# Projects | |
# | |
# Put somewhere in your bashrc, bash_profile, or whatever you're sourcing | |
# and edit the `project_source` line to link to an ENV file representing | |
# your projects: | |
# | |
# roku=~/WhateverDirectory/ | |
# projectb=/var/www/project_b | |
# | |
## | |
project_source=~/Sites/.projects | |
function projects { | |
source ${project_source} | |
case "$1" in | |
edit) | |
vi ${project_source} | |
;; | |
view) | |
cat ${project_source} | |
;; | |
open) | |
dir=$2 | |
open ${!dir} | |
;; | |
goto) | |
dir=$2 | |
cd ${!dir} | |
;; | |
workon) | |
dir=$2 | |
subl ${!dir} | |
;; | |
esac | |
} | |
# | |
# Super quick and dirty, but the idea is that you can quick jump to defined projects in bash. | |
# | |
# `projects edit` - vi into project manager file (to add/remove) | |
# `projects view` - cat the file to see what’s available | |
# `projects goto xyz` - cd to the directory of xyz project | |
# `projects open xyz` - open the directory of xyz project in finder (for mac) | |
# `projects workon xyz` - open directory of xyz project in Sublime (assuming you have `subl` | |
# | |
# Example: | |
# matt@mac ... [] projects view | |
# roku=~/Sites/Clients/Whoever/Roku/v2/ | |
# matt@mac ... [] projects goto roku | |
# matt@mac .../v2 [master] <-- directory of project | |
# matt@mac .../v2 [master] projects workon roku | |
# *opens in sublime* | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment