<gh_stars>1-10
"""
Created on 17 Apr 2017

@author: <NAME> (<EMAIL>)
"""

import optparse


# --------------------------------------------------------------------------------------------------------------------

class CmdControlReceiver(object):
    """unix command line handler"""

    def __init__(self):
        """
        Constructor
        """
        self.__parser = optparse.OptionParser(usage="%prog [-r] [-e] [-v]", version="%prog 1.0")

        # optional...
        self.__parser.add_option("--receipt", "-r", action="store_true", dest="receipt", default=False,
                                 help="print receipt to stdout")

        self.__parser.add_option("--echo", "-e", action="store_true", dest="echo", default=False,
                                 help="echo data to stdout")

        self.__parser.add_option("--verbose", "-v", action="store_true", dest="verbose", default=False,
                                 help="report narrative to stderr")

        self.__opts, self.__args = self.__parser.parse_args()


    # ----------------------------------------------------------------------------------------------------------------

    @property
    def receipt(self):
        return self.__opts.receipt


    @property
    def echo(self):
        return self.__opts.echo


    @property
    def verbose(self):
        return self.__opts.verbose


    # ----------------------------------------------------------------------------------------------------------------

    def print_help(self, file):
        self.__parser.print_help(file)


    def __str__(self, *args, **kwargs):
        return "CmdControlReceiver:{receipt:%s, verbose:%s}" % (self.receipt, self.verbose)

"""
Created on 17 Apr 2017

@author: <NAME> (<EMAIL>)
"""

import optparse


# --------------------------------------------------------------------------------------------------------------------

class CmdControlReceiver(object):
    """unix command line handler"""

    def __init__(self):
        """
        Constructor
        """
        self.__parser = optparse.OptionParser(usage="%prog [-r] [-e] [-v]", version="%prog 1.0")

        # optional...
        self.__parser.add_option("--receipt", "-r", action="store_true", dest="receipt", default=False,
                                 help="print receipt to stdout")

        self.__parser.add_option("--echo", "-e", action="store_true", dest="echo", default=False,
                                 help="echo data to stdout")

        self.__parser.add_option("--verbose", "-v", action="store_true", dest="verbose", default=False,
                                 help="report narrative to stderr")

        self.__opts, self.__args = self.__parser.parse_args()


    # ----------------------------------------------------------------------------------------------------------------

    @property
    def receipt(self):
        return self.__opts.receipt


    @property
    def echo(self):
        return self.__opts.echo


    @property
    def verbose(self):
        return self.__opts.verbose


    # ----------------------------------------------------------------------------------------------------------------

    def print_help(self, file):
        self.__parser.print_help(file)


    def __str__(self, *args, **kwargs):
        return "CmdControlReceiver:{receipt:%s, verbose:%s}" % (self.receipt, self.verbose)
Created on 17 Apr 2017  @author: <NAME> (<EMAIL>) # -------------------------------------------------------------------------------------------------------------------- unix command line handler Constructor # optional... # ---------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------