# Path: quilt/cli/parser.py
# class OptionArgument(Argument):
# 
#     """
#     A class to declare (optional) arguments at a class
# 
#     Usage:
#         class MyParser(Parser):
# 
#             arg1 = OptionArgument(help="A first string argument")
#             arg2 = OptionArgument(type=int)
#             arg3 = OptionArgument(nargs=2)
#             arg4 = OptionArgument(required=True)
#     
#     By default, the option name is taken from the attribute name and prefixed
#     with two dashes, or one dash if the name is a single character:
#     
#     verbose = OptionArgument(action="store_true")  # usage: [--verbose]
#     v = OptionArgument(action="store_true")  # usage: [-v]
#     """
# 
#     prefix_chars = "--"
# 
#     def _get_args(self):
#         args = self.args
#         if not args:
#             if self.prefix_chars == "--" and len(self.name) == 1:
#                 args = ("-" + self.name,)
#             else:
#                 args = (self.prefix_chars + self.name,)
#         return args
# 
# Path: quilt/db.py
# class Db(PatchSeries):
# 
#     """ Represents the "Database" of quilt which contains the list of current
#         applied patches
#     """
# 
#     def __init__(self, dirname):
#         self.version_file = os.path.join(dirname, ".version")
#         if os.path.exists(self.version_file):
#             self.check_version(self.version_file)
#         super(Db, self).__init__(dirname, "applied-patches")
# 
#     def _create_version(self, version_file):
#         with open(version_file, "w") as f:
#             f.write(str(DB_VERSION))
# 
#     def create(self):
#         """ Creates the dirname and inserts a .version file """
#         if not os.path.exists(self.dirname):
#             os.makedirs(self.dirname)
#         self._create_version(self.version_file)
# 
#     def save(self):
#         """ Create version file and save applied patches """
#         self.create()
#         super(Db, self).save()
# 
#     def applied_patches(self):
#         """ Lists all applied patches """
#         return self.patches()
# 
#     def check_version(self, version_file):
#         """ Checks if the .version file in dirname has the correct supported
#             version number """
#         # The file contains a version number as a decimal integer, optionally
#         # followed by a newline
#         with open(version_file, "r") as f:
#             version = f.read(10)
# 
#         version = version.rstrip("\r\n")
# 
#         if len(version) >= 10 or version != str(DB_VERSION):
#             raise DBError("The quilt meta-data version of %s is not supported "
#                           "by python-quilt. python-quilt only supports "
#                           "version %s." % (version, DB_VERSION))
# 
# class Series(PatchSeries):
# 
#     """ Represents the series file of quilt which contains the patches to be
#         applied
#     """
# 
#     def __init__(self, dirname):
#         super(Series, self).__init__(dirname, "series")


from quilt.cli.meta import Command
from quilt.cli.parser import OptionArgument
from quilt.db import Db, Series
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:

# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 - 2017 Björn Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of python-quilt for details.



class SeriesCommand(Command):

    name = "series"
    help = "Print the names of all patches in the series file."

    v = OptionArgument(action="store_true", help="""indicate applied (+)

# Path: quilt/cli/parser.py
# class OptionArgument(Argument):
# 
#     """
#     A class to declare (optional) arguments at a class
# 
#     Usage:
#         class MyParser(Parser):
# 
#             arg1 = OptionArgument(help="A first string argument")
#             arg2 = OptionArgument(type=int)
#             arg3 = OptionArgument(nargs=2)
#             arg4 = OptionArgument(required=True)
#     
#     By default, the option name is taken from the attribute name and prefixed
#     with two dashes, or one dash if the name is a single character:
#     
#     verbose = OptionArgument(action="store_true")  # usage: [--verbose]
#     v = OptionArgument(action="store_true")  # usage: [-v]
#     """
# 
#     prefix_chars = "--"
# 
#     def _get_args(self):
#         args = self.args
#         if not args:
#             if self.prefix_chars == "--" and len(self.name) == 1:
#                 args = ("-" + self.name,)
#             else:
#                 args = (self.prefix_chars + self.name,)
#         return args
# 
# Path: quilt/db.py
# class Db(PatchSeries):
# 
#     """ Represents the "Database" of quilt which contains the list of current
#         applied patches
#     """
# 
#     def __init__(self, dirname):
#         self.version_file = os.path.join(dirname, ".version")
#         if os.path.exists(self.version_file):
#             self.check_version(self.version_file)
#         super(Db, self).__init__(dirname, "applied-patches")
# 
#     def _create_version(self, version_file):
#         with open(version_file, "w") as f:
#             f.write(str(DB_VERSION))
# 
#     def create(self):
#         """ Creates the dirname and inserts a .version file """
#         if not os.path.exists(self.dirname):
#             os.makedirs(self.dirname)
#         self._create_version(self.version_file)
# 
#     def save(self):
#         """ Create version file and save applied patches """
#         self.create()
#         super(Db, self).save()
# 
#     def applied_patches(self):
#         """ Lists all applied patches """
#         return self.patches()
# 
#     def check_version(self, version_file):
#         """ Checks if the .version file in dirname has the correct supported
#             version number """
#         # The file contains a version number as a decimal integer, optionally
#         # followed by a newline
#         with open(version_file, "r") as f:
#             version = f.read(10)
# 
#         version = version.rstrip("\r\n")
# 
#         if len(version) >= 10 or version != str(DB_VERSION):
#             raise DBError("The quilt meta-data version of %s is not supported "
#                           "by python-quilt. python-quilt only supports "
#                           "version %s." % (version, DB_VERSION))
# 
# class Series(PatchSeries):
# 
#     """ Represents the series file of quilt which contains the patches to be
#         applied
#     """
# 
#     def __init__(self, dirname):
#         super(Series, self).__init__(dirname, "series")


# Path: quilt/cli/series.py
from quilt.cli.meta import Command
from quilt.cli.parser import OptionArgument
from quilt.db import Db, Series

# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:

# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 - 2017 Björn Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of python-quilt for details.



class SeriesCommand(Command):

    name = "series"
    help = "Print the names of all patches in the series file."

    v = OptionArgument(action="store_true", help="""indicate applied (+)

        and topmost (=) patches""")