diff --git a/AUTHORS b/AUTHORS index d18f375..92c6c0b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,3 +12,4 @@ * John Jacobsen * rogererens * Thomas Ballinger +* Morten Linderud diff --git a/bin/hy b/bin/hy index 1c19538..3668c54 100755 --- a/bin/hy +++ b/bin/hy @@ -1,9 +1,29 @@ #!/usr/bin/env python import sys - from hy.cmdline import cmdline_handler +class HyQuitter(object): + def __init__(self, name): + self.name = name + + def __repr__(self): + return "Use (%s) or Ctrl-D (i.e. EOF) to exit" % (self.name) + + __str__ = __repr__ + + def __call__(self, code=None): + try: + sys.stdin.close() + except: + pass + raise SystemExit(code) + + +__builtins__.quit = HyQuitter('quit') +__builtins__.exit = HyQuitter('exit') + + if __name__ == '__main__': sys.exit(cmdline_handler("hy", sys.argv))