#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals

import sys
import codecs

import tohaml

usage = \
"""
toHAML - an HTML to HAML converter, targeting the HamlPy compiler
Copyright (c) 2013, Bosco Ho.

usage: tohaml html [haml]
"""


if __name__ == '__main__':
  if len(sys.argv) < 2:
    print(usage)
  else:
    if len(sys.argv) > 2:
      out_f = codecs.open(sys.argv[2], 'w', encoding='utf-8')
    else:
      out_f = sys.stdout
    in_stream = codecs.open(sys.argv[1])
    tohaml.print_haml(in_stream, out_f)



