#!/usr/bin/env python
"""
Usage:
  hello [options] [NAME]

Options:
  -d, --debug         Print debug info
  -h, --help          Print help info
  -t, --title TITLE   Title to use (ex: Mr.)
      --lower         Lower case everything
  --version           Print version

"""
from docopt import docopt
import pkg_resources

from hello_module.hello import Hello

if __name__ == '__main__':

    version = pkg_resources.get_distribution('hello_python_cli').version
    arguments = docopt(__doc__, version=version)

    debug = arguments['--debug']
    if debug:
        print('arguments:', arguments)

    name = arguments['NAME']
    if not name:
        name = 'world'
    title = arguments['--title']
    lower = arguments['--lower']

    h = Hello(name)
    if title:
        h.title = title
    if lower:
        print(h.transform())
    else:
        print(h.hello())
