#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Spell-checker for various languages and data formats."""


import argparse

# pyspell modules
import pyspell
from pyspell import check

# Every pyspell tool that should be available through
#   pyspell TOOL
# has to be added to ``get_parser()`` and to ``main``.


def get_parser():
    """Return the parser object for this script."""
    parser = argparse.ArgumentParser(description=__doc__,
                                     prog='pyspell')
    subparsers = parser.add_subparsers(dest='cmd')
    subparsers.add_parser('check',
                          add_help=False,
                          description="""check spelling, grammar and
                                         conventions""",
                          parents=[check.get_parser()])
    parser.add_argument('--version',
                        action='version',
                        version=('pyspell %s' % str(pyspell.__version__)))
    return parser


def main(args):
    if args.cmd == 'check':
        check.main(args.s1, args.s2)

if __name__ == '__main__':
    args = get_parser().parse_args()
    main(args)
