projects

You're a prolific developer (or you want to be). Manage, keep track of, and show off your projects.

You're a prolific developer (or you want to be). Manage, keep track of, and show off your projects with ease.

$ npm install -g projects

For autocompletion you can redirect projects --completion to a file in ~/.bash_completion (zsh is also supported) or use projects-modified.sh which also contains a fallback to _filedir so that you can still complete files and directories (I've opened an issue to get that improvement back into omelette, the completion library we use).

CommandDescription
aliasoutput shell aliases
clonegit clone a project
eachrun a command in each project directory
editedit projects files
gccompact the projects database
getget an attribute for a project
git-statusgit status across all repositories
git-unpusheddisplay repositories with unpushed commits
githubfill your projects database with your GitHub repositories
globglob across all project directories
infoshow the JSON for a given project
json-inimport your projects from plain JSON
json-outexport your projects to plain JSON
openopen a project's homepage
queryquery your projects
remindget a reminder of what you were last working on
setset an attribute to a given value for a project

Projects is primarily a framework for making it easy to execute actions on one or more of your projects. For example, you could write a command to check the clean/dirty status of all of your checked out git repositories and list the dirty ones.

If you have an executable file in your PATH that starts with projects- then you can execute it underneath projects (and you're encouraged to share them with others!)

alias p=projects
$ cat ~/.config/projects
[github]
username = beaugunderson
 
[projects]
directory = ~/p
 
$ p info vim-scss-instead
{
  "name""vim-scss-instead",
  "repository""https://github.com/beaugunderson/vim-scss-instead.git",
  "language""VimL",
  "role""creator",
  "released"true,
  "status""inactive"
}
 
$ p set vim-scss-instead homepage https://github.com/beaugunderson/vim-scss-instead
Set vim-scss-instead:homepage to "https://github.com/beaugunderson/vim-scss-instead"
$ p open vim-scss-instead # opens a web browser to the homepage URL 
$ p clone vim-scss-instead
Cloning into '/Users/beau/p/vim-scss-instead'...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4)done.
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5)done.
 
$ p github
<snip>
Adding vim-scss-instead
Adding vim-human-dates
<snip>
Finished
 
$ p git-unpushed
node-helmsman: 6 commits ahead of origin
projects: 3 commits ahead of origin

You can also use something like fzf to make selecting a project via the CLI very easy:

contract-home() {
  sed "s|^$HOME|~|"
}
 
# cd to a project via fzf 
pd() {
  cd $(projects ls -1 | \
    fzf --query="$1" | \
    xargs -I {} projects get --porcelain "{}" directory)
}
 
# open a project's URL via fzf 
po() {
  open $(projects ls -1 | \
    fzf --query="$1" | \
    xargs -I {} projects get --porcelain "{}" homepage)
}
 
# edit a project file with $EDITOR via fzf 
# note: requires gnu findutils 
# on OS X you'll want to: 
# `npm install -g ignore-pipe` 
# `brew install findutils --with-default-names` 
pe() {
  FILTERS='-type f '
 
  # filter out .git and node_modules with -prune to make the find much faster 
  FILTERS+='-not -path \*/.git/\* -prune '
  FILTERS+='-not -path \*/node_modules/\* -prune '
 
  ADDITIONAL_FILTERS=$1
 
  if PROJECT_DIRECTORY=`projects resolve --relative .`; then
    FILE=$(bash -c "find $PROJECT_DIRECTORY \
      $FILTERS $ADDITIONAL_FILTERS 2> /dev/null" | \
        ignore-pipe | contract-home | fzf)
  else
    FILE=$(projects glob --expand | \
      xargs -I {} bash -c "find "{}" \
        $FILTERS $ADDITIONAL_FILTERS 2> /dev/null" | \
         ignore-pipe | contract-home | fzf)
  fi
 
  # bash -c needed to handle tilde expansion 
  [ ! -z "$FILE" ] && bash -c "${EDITOR:-vim} "$FILE""
}
 
# edit a project file modified within in the last 7 days 
per() {
  pe "-mtime -7"
}