DEV Community

Cover image for Managing your projects
Konstantin
Konstantin

Posted on

Managing your projects

As most of developers I have ~/projects folder where I stock all my projects.

To jump from one project to another I normally use either a cd with

GitHub logo zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh

or

GitHub logo rupa / z

z - jump around

But sometimes I get to a wrong folder (z sometimes jumps to parent folder) and if I want to create a project I have to:

  • create folder
  • cd to it
  • do git init
  • do npm init or cargo init
  • do hub create

A lot of stuff, just to create a project.

Enter gko/project

Some time ago I created a small zsh plugin (it works in bash as well):

GitHub logo gko / project

☕️ Create node, rust, python or ruby project locally and on github (private or public)

Project

Create npm, cargo, gem or pip project locally and on github or just cd into existing.

demo

After project init you will be prompted to create a github repo (private or public).

github

You can read more about it in the «Managing your projects» article.

Installation

You will need to install github cli (see this installation instructions) in order to create project repository on github.

With antigen

In your .zshrc

antigen bundle gko/project
Enter fullscreen mode Exit fullscreen mode

Manually

You need to clone repo:

git clone --recursive --depth 1 https://github.com/gko/project
Enter fullscreen mode Exit fullscreen mode

then add it to .bashrc or .zshrc:

source ./project/project.sh
Enter fullscreen mode Exit fullscreen mode

Usage

Usage: project [options]
Example
  project -p test
Options:
  -h, --help      help
  -p, --private   create private github repository
  -f, --folder    your projects folder(defaults to ~/projects)
  -n, --no-init   avoid initializing package

then to create public repo:

project test
Enter fullscreen mode Exit fullscreen mode

create private repo:

project -p test
Enter fullscreen mode Exit fullscreen mode

If the project exist you will just cd

It allows you to just type:

project <project name>
Enter fullscreen mode Exit fullscreen mode

and it will prompt you to create npm, cargo, gem or pip package

Create package

as well as a private or public github repo (you need to install and configure hub for that) and jump into it:

Create repository

If the project exists you will just cd to the project folder.

Project folder

By default project folder is ~/projects but you can either specify another folder when running project:

project -f /projects_path
Enter fullscreen mode Exit fullscreen mode

or use PROJECTS_HOME variable

export PROJECTS_HOME=/projects_path
Enter fullscreen mode Exit fullscreen mode

ZSH autocomplete

It supports zsh-autocomplete. On Tab will show the list of available projects.

Alias it

You can also alias it (in ~/.zshrc or ~/.bashrc):

alias p='project'
Enter fullscreen mode Exit fullscreen mode

to get:

p test-project
Enter fullscreen mode Exit fullscreen mode

Top comments (0)