def main():
    """
    Usage: pre-sugartex [OPTIONS]

      Reads from stdin and writes to stdout.
      When no options: only replace
      U+02CE Modifier Letter Low Grave Accent
      (that looks like low '`') with $

    Options:
      --all    Full SugarTeX replace with regexp,
      --kiwi   Same as above but with kiwi flavor,
      --help   Show this message and exit.
    """
    if len(sys.argv) > 1:
        arg1 = sys.argv[1]
        if arg1 == '--all' or arg1 == '--kiwi':
            if arg1 == '--kiwi':
                sugartex.mjx_hack()
                # sugartex.subscripts['ᵩ'] = 'ψ'  # Consolas font specific
                # sugartex.superscripts['ᵠ'] = 'ψ'  # Consolas font specific
            sugartex.ready()
            sys.stdout.write(sugartex_replace_all(sys.stdin.read()))
        elif arg1.lower() == '--help':
            print(str(main.__doc__).replace('\n    ', '\n'))
        else:
            raise Exception("Invalid first argument: " + arg1)
    else:
        sys.stdout.write(sugartex_preprocess(sys.stdin.read()))