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

"Command-line tool for converting integers to Esperanto strings."

import sys


from eonums import int2eo


try:
    arg = sys.argv[1]
except IndexError:
    print """Usage: int2eo INTEGER
Example: $ int2eo 123
cent dudek tri"""
    sys.exit()

try:
    num = int(arg)
except ValueError, details:
    print "ValueError:", details
    sys.exit()

try:
    assert num >= 0
except AssertionError:
    print "AssertionError:", "Not a positive integer"
    sys.exit()

try:
    eo = int2eo(num)
    print eo
except ValueError, details:
    print "ValueError:", details
