--- /dev/null
+#!/usr/bin/env python3
+
+# Standard modules
+import sys
+import os
+import logging
+import locale
+
+# own modules:
+cur_dir = os.getcwd()
+base_dir = cur_dir
+
+if sys.argv[0] != '' and sys.argv[0] != '-c':
+ bin_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
+else:
+ bin_dir = os.path.dirname(os.path.realpath(__file__))
+base_dir = os.path.abspath(os.path.join(bin_dir, '..'))
+module_dir = os.path.join(base_dir, 'pp_lib')
+if os.path.exists(module_dir):
+ sys.path.insert(0, base_dir)
+
+from pp_lib.idna_xlate import IdnaXlateApp
+
+log = logging.getLogger(__name__)
+
+__author__ = 'Frank Brehm <frank.brehm@pixelpark.com>'
+__copyright__ = '(C) 2018 by Frank Brehm, Pixelpark GmbH, Berlin'
+
+appname = os.path.basename(sys.argv[0])
+
+locale.setlocale(locale.LC_ALL, '')
+
+app = IdnaXlateApp(appname=appname)
+
+if app.verbose > 2:
+ print("{c}-Object:\n{a}".format(c=app.__class__.__name__, a=app))
+
+app()
+
+sys.exit(0)
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2018 by Frank Brehm, Berlin
+@summary: The module for the 'idna-xlate' application object.
+"""
+from __future__ import absolute_import
+
+# Standard modules
+import logging
+import textwrap
+import sys
+import copy
+
+# Third party modules
+import six
+
+# Own modules
+from .common import pp, to_str, to_bytes
+
+from .app import PpApplication
+
+try:
+ from .local_version import __version__ as my_version
+except ImportError:
+ from .global_version import __version__ as my_version
+
+__version__ = '0.1.0'
+LOG = logging.getLogger(__name__)
+
+
+# =============================================================================
+class IdnaXlateApp(PpApplication):
+ """
+ Application class for the idna-xlate command.
+ """
+
+ # -------------------------------------------------------------------------
+ def __init__(
+ self, appname=None, verbose=0, version=my_version, *arg, **kwargs):
+
+ self.items = []
+
+ indent = ' ' * self.usage_term_len
+
+ usage = textwrap.dedent("""\
+ %(prog)s [--color [{{yes,no,auto}}]] [-v | -q] ITEM [ITEM ...]
+
+ {i}%(prog)s --usage
+ {i}%(prog)s -h|--help
+ {i}%(prog)s -V|--version
+ """).strip().format(i=indent)
+
+ desc = "Formats the given items into IDNA formatted strings (Punycode)."
+
+ super(IdnaXlateApp, self).__init__(
+ usage=usage,
+ description=desc,
+ verbose=verbose,
+ version=version,
+ *arg, **kwargs
+ )
+
+ self.post_init()
+
+ self.initialized = True
+
+ # -------------------------------------------------------------------------
+ def init_arg_parser(self):
+ """
+ Method to initiate the argument parser.
+ """
+
+ super(IdnaXlateApp, self).init_arg_parser()
+
+
+ self.arg_parser.add_argument(
+ 'items',
+ metavar='ITEM', type=str, nargs='+',
+ help=(
+ 'The item to translate into IDNA encoded strings.'),
+ )
+
+ # -------------------------------------------------------------------------
+ def _run(self):
+ """The underlaying startpoint of the application."""
+
+ if self.verbose:
+ print("Items to translate:\n")
+
+ for item in self.args.items:
+
+ print(" * {i!r}:".format(i=item))
+
+# =============================================================================
+
+if __name__ == "__main__":
+
+ pass
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list