#!/usr/bin/env python

import nephelo
import os
import sys

config = nephelo.configure()
if config == None:
    print "No Config File - Exiting"
    sys.exit()

args = sys.argv
filepath = args.pop(0)
if len(args) == 0:
    print "Please pass through a command, e.g. nephelo deploy development"
    sys.exit()

command = args[0]

if command == "deploy":
    stage = args[1]
    config["stage"] = stage
    nephelo.deploy(config, stage)
    sys.exit()
elif command == "get":
    segment = args[1]
    stage = args[2]
    config["stage"] = stage
    print nephelo.get(filepath, config, segment, stage)
    sys.exit()
elif command == "help":
    print "usage: nephelo deploy {stage} || nephelo get network {stage}"
    sys.exit()
elif command == "save":
    stage = args[1]
    config["stage"] = stage
    nephelo.save(config, stage)
elif command == "delete":
    stage = args[1]
    config["stage"] = stage
    nephelo.deleteStack(config, stage)
else:
    print "please type a command, try nephelo help"
    sys.exit()