davla / project-wrapper

A simple bash-CLI utility to easy access projects around the filesystem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

project-wrapper

πŸ’€πŸ’€πŸ’€ This repository is archived 😭 I'm not maintaining it anymore, as I switched to zsh and wd πŸ’€πŸ’€πŸ’€

A simple bash-CLI utility to easy access and setup projects around the filesystem.

What is this?

Are you like me, burying projects under deeply nested directories every damn time, even though you have the memory of a goldfish? And are you also like me, forgetting every single time to activate whatever environment setup the language needs, like pyhton virtual environments or the right version of node.js? Then, this may be what you've been looking for for ages!

The idea is pretty simple and straightforward: named projects associated to a path in the filesystem, that can be activated by entering a terminal command. Upon activation, the path is cd-ed into and the language-specific environment setup are executed, if necessary.

Table of contents

Features

  • Name-path mapping to quick access directories across the filesystem.
  • Autocompletion of project names when possible.
  • Node.js version activation (requires .nvmrc):
  • Python virtual environments activation:
  • Ruby environment activation:

What about pyenv and rbenv?

Both rbenv and its python fork pyenv do not need activation in the current shell. This means that nothing needs to be done by this tool if you use them.

Roadmap

  • Project names autocompletion
  • Build and installation
  • Only edit bashrc if source is not there already
  • Import/export
  • Startup script
  • Clear all entries
  • Static configuration
  • Help message
  • File-system deletion
  • Auto-recognition of current active project

Installation

The installation is make-based. The goals are the following:

  • install - to make the commands available for the current user.
  • uninstall - to remove all traces of the installed software from the system.
  • test - to install the commands in $HOME/proj-test, for testing purposes.
  • untest - to remove the testing environment.

Therefore, the whole machinery is installed with the following command in the repository root directory:

make install

Two configuration parameters can be passed in the form of environment variables anytime. In order to make the configuration persistent, such variables should be permanently exported, for example in $HOME/.bashrc. The variables are:

  • $PROJ_BASE - The base directory where the files will be located. Defaults to $HOME/.projects.
  • $PROJ_DB_FILE - The file that stores the mapping. Defaults to $PROJ_BASE/projects.

A few details

The main functionality needs to change the current working directory. Furthermore, many language-specific environment setup also work on the current shell. As a result, the commands are not separate files, but shell functions, that need to be included in every new shell. These are the reasons why the main implementation file needs to be sourced in $HOME/.bashrc, or anywhere else executed when opening a new interactive shell.

Usage

The add-proj command adds/modifies a project to/in the mapping. It supports autocompletion for both arguments, the first over project names and the second as directories. It has the following syntax:

add-proj PROJECT-NAME BASE-DIR

BASE-DIR can be an absolute path or relative to the current directory. The add-proj command also cds in BASE-DIR

The del-proj command is used to delete a project from the mapping. It supports autocompletion of project names. Its syntax is:

del-proj PROJECT-NAME

The ls-proj command displays the current mapping. It has the syntax:

ls-proj

The new-proj command is just a shorthand for add-proj that also create the project directory if it doesn't already exist. Its syntax is:

new-proj PROJECT-NAME BASE-DIR

A project is activated via the proj command, that has the following syntax:

proj PROJECT-NAME

The proj command cds into the directory mapped to PROJECT-NAME, if any, and the proceeds to the activation of language-specific environment setup. It also supports autocompletion of project names.

About

A simple bash-CLI utility to easy access projects around the filesystem

License:GNU General Public License v3.0


Languages

Language:Shell 81.0%Language:Makefile 19.0%