Giter VIP home page Giter VIP logo

alias-gen's Introduction

alias-gen

The idea behind this script is that we have many git repos (dozens of them) working in an environment that embrace microservices. As a result, we have many folders under the workspace. It becomes time consuming simply switching from one git repo to another. This script is for generating a shortcut for opening repo from the command line. For example, if you have a repo called Mumbai, you can simply switch to that repo by typing go2_mumbai in your terminal regardless where you are.

Environment

We use conda for managing environment here. Cheat sheet for create, update, and sharing.

conda env create -f environment.yml
conda env update -f environment.yml
conda env export --no-builds | grep -v "prefix" > environment_freeze.yml

Usage

Activate environment and run alias_gen.

conda activate alias_gen
python alias_gen.py

It which will then generate a file ~/.alias-gen.

#
# Generated by alia-gen.py
#
alias detroit="cd /Users/yuchen/Documents/Detroit"
alias draggablepanel="cd /Users/yuchen/Documents/DraggablePanel"
alias durham="cd /Users/yuchen/Documents/Durham"
alias helpers="cd /Users/yuchen/Documents/Helpers"
alias mountainview="cd /Users/yuchen/Documents/MountainView"
alias mumbai="cd /Users/yuchen/Documents/Mumbai"
# Skiping directory 'RxSwift_Reactive_Programming_with_Swift_v2.0' because it is not a git repo
alias seattle="cd /Users/yuchen/Documents/Seattle"
alias springfield="cd /Users/yuchen/Documents/Springfield"

You can add --dry-run to see the output before saving the output to file.

And finally add this to ~/.bash_profile so that it updates automatically.

# Added for generating alias for navigating to git repos
if [ -f ~/.alias_gen ]; then 
    . ~/.alias_gen;
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.