diff --git a/README.md b/README.md new file mode 100644 index 0000000..cb78fe2 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# g + +Use instead of git. + +## Usage: + +``` + g add file + g add . + g commit -m "message + g push origin branch-name + g log +``` + +## Features + +if the file is a js file, it will try to validate the syntax before adding +it to the repo, if the file has bad syntax, it will not be added to the repo. + +## Supported Languages + +- Javascript + +## Upcoming + +- Maybe CSS, php, etc. + +## Installation: + +put it on a file in your machine and later ad this line to bashrc: + +export PATH=$PATH:/place/where/you/put/the/command + diff --git a/g b/g new file mode 100755 index 0000000..bd972ef --- /dev/null +++ b/g @@ -0,0 +1,36 @@ +#!/bin/bash +# vim: syn=sh + +# This file will check before adding on git, use as you would +# normally use git. +# Apologies for using bash, I guess I guess we can add +# more languages in the futurewith care. + +do_add() { + for file in "$PARAMS" + do + case $file in *.js ) + printf "$(tput setaf 1)" + node --check $file && git $CMD $file + printf "$(tput sgr0)" + ;; + * ) + echo "$(tput setaf 1)Unchecked$(tput sgr0)" + git $CMD $file + esac + done +} +main () { + if [ "$CMD" = "add" ]; then + do_add + else + git $CMD $PARAMS + fi +} + +CMD=$1 +shift +PARAMS=$@ +main + +