Code Monkey home page Code Monkey logo

shgit's Introduction

shgit

Unintrusive, lightweight git shell. Design/implementation considerations:

  • No external dependencies other than git and bash
  • 256 Colors (c'mon, it's 2018)
  • Configurable through git
  • Modular, and extendable
  • By default, invoke as little git operations as possible (for stupid enterprise environments/slow homes/low resources)
  • Works with vanilla bash
  • Doesn't clobber your personal aliases/setups (or at least tries to)

Installation:

  1. git clone [email protected]:roeme/shgit.git
  2. cd shgit && ./install.sh install

Customization:

shgit is configured through git, and uses the section [shgit] if there's no fitting standard section. The following options are available in [shgit]:

  • quiet_init (Boolean, Default false):

    Don't print initialization messages.

  • suppress_keyword_alert (Boolean, Default false):

    If your aliases include a shell keyword, shgit will warn upon this and won't make the alias available at top-level. This setting will suppress the message.

  • pwd-max-len (Int, Default 20):

    Maximum length of working directory to display in prompt (longer will be truncated).

  • trunc-symbol (String, Default "โ€ฆ"):

    Truncation character to be used for working directory display.

  • prompt-command-mode (Enum, Default "override"):

    Tells shgit how to modify the prompt.

    • override: Use shgit's standard prompt.

    • stealthy: Simply prepend ps1-prefix to $PS1 to indicate shgit. If PROMPT_COMMAND is set, it will be modified by shgit to make sure $PS1 is adjusted.

    • no-touchy: Instructs to shgit to not touch $PROMPT_COMMAND at all and leave your original setting intact. Make sure you don't get confused when using this, as depending on your settings there might be no visual indication that the shell environment has been modified (You'll probably want stealthy instead).

    • custom: Run a completely custom $PROMPT_COMMAND, set in custom-prompt-command. If you want to implement your own custom prompt, have a look at the internal function shgit_prompt_cmd to cherry-pick whatever you need.

    The settings stealthy and no-touchy will stop shgit from executing any git commands whatsoever when prompting the user, rendering the shell even faster. When using custom, that is up to you, naturally.

  • ps1-prefix (String, Default "๐Ÿš "):

    Custom prefix that gets prepended to "$PS1" when prompt-command-mode is set to stealthy.

  • custom-prompt-command (String, Default unset):

    Custom $PROMPT_COMMAND. Only read if prompt-command-mode has been set to custom, ignored otherwise.

  • hook-cd (Boolean, Default false)

    Tells shgit to hook cd, so instead of cwd to $HOME by default, this will move to the current repo's root.

  • verbose-exec (Boolean, Default false)

    Tells shgit to echo what git commands will be executed. This also expands your own git aliases to a certain degree. This is useful for teaching&learning git.

Colors

Colors can be configured through git, by using the standard [color] section. shgit uses the shgit prefix for configurable items. Have a look into the code for a current list of things that can be colorized.

Credits

Heavily inspired by Ryan Tomayko's git-sh.

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.