# Path: django_sonic_screwdriver/git/git.py
# GIT_OPTIONS = {
#     "DEVELOPMENT": "development",
#     "STAGING": "staging",
#     "PRODUCTION": "production",
# }
# class Git:
#     def create_git_version_tag(deploy_tag):
#     def get_current_branch():
#     def get_latest_tag():
#     def check_existence_of_staging_tag_in_remote_repo():
#     def __debug(command, dry=False):
#     def __git_tag(git_tag):
#     def __git_tag_gpg(git_tag):
#     def __git_tag_push():
#     def __git_tag_delete(git_tag):
#     def __git_push(self):
#     def tag(self, deploy_tag=""):
#     def push_tags(self):
#     def tag_delete(self, tag):
# 
# Path: django_sonic_screwdriver/utils/shell.py
# ANSCI_ESCAPE = re.compile(r"\x1b[^m]*m")
# STDERR_WRITER = getwriter("utf-8")(stderr.buffer)
# STDOUT_WRITER = getwriter("utf-8")(stdout.buffer)
#     __HEADER = "\033[95m"
#     __OK_BLUE = "\033[94m"
#     __OK_GREEN = "\033[92m"
#     __WARNING = "\033[93m"
#     __FAIL = "\033[91m"
#     __ENDC = "\033[0m"
#     __BOLD = "\033[1m"
#     __UNDERLINE = "\033[4m"
# def ansi_clean(string):
# def write_to_stream(stream, msg):
#     def msg(self, msg, append_new_line=True):
#     def success(self, msg, append_new_line=True):
#     def warn(self, msg, append_new_line=True):
#     def fail(self, msg, append_new_line=True):
#     def debug(self, msg, append_new_line=True):
#     def __text(self, msg, color):
#     def __out(self, msg, color=None, append_new_line=False):
# class Shell:


from django.core.management.base import BaseCommand
from django_sonic_screwdriver.git import git
from django_sonic_screwdriver.utils.shell import shell



class Command(BaseCommand):

    args = "tag"
    help = "Remove last or given tag."

    def handle(self, *args, **options):
        if args:
            shell.warn("Do you want to remove tag " + str(args[0]) + "? (Y/n)")
            confirmation = input()
            if confirmation != "n":
                git.tag_delete(str(args[0]))

        else:
            shell.warn("Do you want to remove tag " + git.get_latest_tag() + "? (Y/n)")
            confirmation = input()
            if confirmation != "n":

# Path: django_sonic_screwdriver/git/git.py
# GIT_OPTIONS = {
#     "DEVELOPMENT": "development",
#     "STAGING": "staging",
#     "PRODUCTION": "production",
# }
# class Git:
#     def create_git_version_tag(deploy_tag):
#     def get_current_branch():
#     def get_latest_tag():
#     def check_existence_of_staging_tag_in_remote_repo():
#     def __debug(command, dry=False):
#     def __git_tag(git_tag):
#     def __git_tag_gpg(git_tag):
#     def __git_tag_push():
#     def __git_tag_delete(git_tag):
#     def __git_push(self):
#     def tag(self, deploy_tag=""):
#     def push_tags(self):
#     def tag_delete(self, tag):
# 
# Path: django_sonic_screwdriver/utils/shell.py
# ANSCI_ESCAPE = re.compile(r"\x1b[^m]*m")
# STDERR_WRITER = getwriter("utf-8")(stderr.buffer)
# STDOUT_WRITER = getwriter("utf-8")(stdout.buffer)
#     __HEADER = "\033[95m"
#     __OK_BLUE = "\033[94m"
#     __OK_GREEN = "\033[92m"
#     __WARNING = "\033[93m"
#     __FAIL = "\033[91m"
#     __ENDC = "\033[0m"
#     __BOLD = "\033[1m"
#     __UNDERLINE = "\033[4m"
# def ansi_clean(string):
# def write_to_stream(stream, msg):
#     def msg(self, msg, append_new_line=True):
#     def success(self, msg, append_new_line=True):
#     def warn(self, msg, append_new_line=True):
#     def fail(self, msg, append_new_line=True):
#     def debug(self, msg, append_new_line=True):
#     def __text(self, msg, color):
#     def __out(self, msg, color=None, append_new_line=False):
# class Shell:


# Path: django_sonic_screwdriver/management/commands/git:tag:delete.py
from django.core.management.base import BaseCommand
from django_sonic_screwdriver.git import git
from django_sonic_screwdriver.utils.shell import shell




class Command(BaseCommand):

    args = "tag"
    help = "Remove last or given tag."

    def handle(self, *args, **options):
        if args:
            shell.warn("Do you want to remove tag " + str(args[0]) + "? (Y/n)")
            confirmation = input()
            if confirmation != "n":
                git.tag_delete(str(args[0]))

        else:
            shell.warn("Do you want to remove tag " + git.get_latest_tag() + "? (Y/n)")
            confirmation = input()
            if confirmation != "n":

                git.tag_delete(None)