# Path: zfs_autobackup/LogConsole.py
# class LogConsole:
#     """Log-class that outputs to console, adding colors if needed"""
# 
#     def __init__(self, show_debug, show_verbose, color):
#         self.last_log = ""
#         self.show_debug = show_debug
#         self.show_verbose = show_verbose
#         self._progress_uncleared=False
# 
#         if color:
#             # try to use color, failback if colorama not available
#             self.colorama=False
#             try:
#                 import colorama
#                 global colorama
#                 self.colorama = True
#             except ImportError:
#                 pass
# 
#         else:
#             self.colorama=False
# 
#     def error(self, txt):
#         self.clear_progress()
#         if self.colorama:
#             print(colorama.Fore.RED + colorama.Style.BRIGHT + "! " + txt + colorama.Style.RESET_ALL, file=sys.stderr)
#         else:
#             print("! " + txt, file=sys.stderr)
#         sys.stderr.flush()
# 
#     def warning(self, txt):
#         self.clear_progress()
#         if self.colorama:
#             print(colorama.Fore.YELLOW + colorama.Style.BRIGHT + "  NOTE: " + txt + colorama.Style.RESET_ALL)
#         else:
#             print("  NOTE: " + txt)
#         sys.stdout.flush()
# 
#     def verbose(self, txt):
#         if self.show_verbose:
#             self.clear_progress()
#             if self.colorama:
#                 print(colorama.Style.NORMAL + "  " + txt + colorama.Style.RESET_ALL)
#             else:
#                 print("  " + txt)
#             sys.stdout.flush()
# 
#     def debug(self, txt):
#         if self.show_debug:
#             self.clear_progress()
#             if self.colorama:
#                 print(colorama.Fore.GREEN + "# " + txt + colorama.Style.RESET_ALL)
#             else:
#                 print("# " + txt)
#             sys.stdout.flush()
# 
#     def progress(self, txt):
#         """print progress output to stderr (stays on same line)"""
#         self.clear_progress()
#         self._progress_uncleared=True
#         print(">>> {}\r".format(txt), end='', file=sys.stderr)
#         sys.stderr.flush()
# 
#     def clear_progress(self):
#         if self._progress_uncleared:
#             import colorama
#             print(colorama.ansi.clear_line(), end='', file=sys.stderr)
#             # sys.stderr.flush()
#             self._progress_uncleared=False


import argparse
import os.path
import sys
from .LogConsole import LogConsole
            print("ARGUMENTS: " + " ".join(argv))

    def parse_args(self, argv):
        """parses the arguments and does additional checks, might print warnings or notes
        Overridden in subclasses with extra checks.
        """

        args = self.parser.parse_args(argv)

        if args.help:
            self.parser.print_help()
            sys.exit(255)

        if args.version:
            print(self.HEADER)
            sys.exit(255)

        # auto enable progress?
        if sys.stderr.isatty() and not args.no_progress:
            args.progress = True

        if args.debug_output:
            args.debug = True

        if args.test:
            args.verbose = True

        if args.debug:
            args.verbose = True


# Path: zfs_autobackup/LogConsole.py
# class LogConsole:
#     """Log-class that outputs to console, adding colors if needed"""
# 
#     def __init__(self, show_debug, show_verbose, color):
#         self.last_log = ""
#         self.show_debug = show_debug
#         self.show_verbose = show_verbose
#         self._progress_uncleared=False
# 
#         if color:
#             # try to use color, failback if colorama not available
#             self.colorama=False
#             try:
#                 import colorama
#                 global colorama
#                 self.colorama = True
#             except ImportError:
#                 pass
# 
#         else:
#             self.colorama=False
# 
#     def error(self, txt):
#         self.clear_progress()
#         if self.colorama:
#             print(colorama.Fore.RED + colorama.Style.BRIGHT + "! " + txt + colorama.Style.RESET_ALL, file=sys.stderr)
#         else:
#             print("! " + txt, file=sys.stderr)
#         sys.stderr.flush()
# 
#     def warning(self, txt):
#         self.clear_progress()
#         if self.colorama:
#             print(colorama.Fore.YELLOW + colorama.Style.BRIGHT + "  NOTE: " + txt + colorama.Style.RESET_ALL)
#         else:
#             print("  NOTE: " + txt)
#         sys.stdout.flush()
# 
#     def verbose(self, txt):
#         if self.show_verbose:
#             self.clear_progress()
#             if self.colorama:
#                 print(colorama.Style.NORMAL + "  " + txt + colorama.Style.RESET_ALL)
#             else:
#                 print("  " + txt)
#             sys.stdout.flush()
# 
#     def debug(self, txt):
#         if self.show_debug:
#             self.clear_progress()
#             if self.colorama:
#                 print(colorama.Fore.GREEN + "# " + txt + colorama.Style.RESET_ALL)
#             else:
#                 print("# " + txt)
#             sys.stdout.flush()
# 
#     def progress(self, txt):
#         """print progress output to stderr (stays on same line)"""
#         self.clear_progress()
#         self._progress_uncleared=True
#         print(">>> {}\r".format(txt), end='', file=sys.stderr)
#         sys.stderr.flush()
# 
#     def clear_progress(self):
#         if self._progress_uncleared:
#             import colorama
#             print(colorama.ansi.clear_line(), end='', file=sys.stderr)
#             # sys.stderr.flush()
#             self._progress_uncleared=False


# Path: zfs_autobackup/CliBase.py
import argparse
import os.path
import sys
from .LogConsole import LogConsole

            print("ARGUMENTS: " + " ".join(argv))

    def parse_args(self, argv):
        """parses the arguments and does additional checks, might print warnings or notes
        Overridden in subclasses with extra checks.
        """

        args = self.parser.parse_args(argv)

        if args.help:
            self.parser.print_help()
            sys.exit(255)

        if args.version:
            print(self.HEADER)
            sys.exit(255)

        # auto enable progress?
        if sys.stderr.isatty() and not args.no_progress:
            args.progress = True

        if args.debug_output:
            args.debug = True

        if args.test:
            args.verbose = True

        if args.debug:
            args.verbose = True


        self.log = LogConsole(show_debug=args.debug, show_verbose=args.verbose, color=sys.stdout.isatty())