#!/usr/bin/python3

import sys
from fabric.api import env, task, local

__author__ = 'flat'
__version__ = '1.0'

env.hosts = ['localhost']
env.colorize_errors = 'True'
env.disable_known_hosts = 'True'

args = sys.argv[1:]
if not args:
    print("Usage: fab { git | add | commmit | push | pull | status} \n")
    print("Description:")
    print("* git: add + commit + push")
    print("* add: track all files")
    print("* commit: commit files tracked and write a commment on VI")
    print("* push: push the code on the GIT server")
    print("* pull: pull new code from the GIT server")
    print("* status: check the status of the local repository \n")
    sys.exit(1)

@task
def add():
    local('/usr/bin/git add -A .')

@task
def commit():
    local('/usr/bin/git commit')

@task
def push():
    local('/usr/bin/git push')

@task
def pull():
    local('/usr/bin/git pull')

@task
def status():
    local('/usr/bin/git status')

@task
def git():
    add()
    commit()
    push()