20
20
# TODO: probably should say which arguments are candidates for glob
21
21
# expansion on windows and do that at the command level.
23
# TODO: Help messages for options.
25
# TODO: Define arguments by objects, rather than just using names.
26
# Those objects can specify the expected type of the argument, which
27
# would help with validation and shell completion.
1934
1939
def main(argv):
1936
1940
bzrlib.trace.open_tracefile(argv)
1941
return run_bzr(argv[1:])
1943
# do this here inside the exception wrappers to catch EPIPE
1946
quiet = isinstance(e, (BzrCommandError))
1947
_report_exception('error: ' + str(e), quiet=quiet)
1950
# some explanation or hints
1953
except AssertionError, e:
1954
msg = 'assertion failed'
1956
msg += ': ' + str(e)
1957
_report_exception(msg)
1959
except KeyboardInterrupt, e:
1960
_report_exception('interrupted', quiet=True)
1962
except Exception, e:
1965
if (isinstance(e, IOError)
1966
and hasattr(e, 'errno')
1967
and e.errno == errno.EPIPE):
1971
msg = str(e).rstrip('\n')
1972
_report_exception(msg, quiet)
1975
bzrlib.trace.close_trace()
1944
return run_bzr(argv[1:])
1946
# do this here inside the exception wrappers to catch EPIPE
1948
except BzrCommandError, e:
1949
# command line syntax error, etc
1953
bzrlib.trace.log_exception()
1955
except AssertionError, e:
1956
bzrlib.trace.log_exception('assertion failed: ' + str(e))
1958
except KeyboardInterrupt, e:
1959
bzrlib.trace.note('interrupted')
1961
except Exception, e:
1963
if (isinstance(e, IOError)
1964
and hasattr(e, 'errno')
1965
and e.errno == errno.EPIPE):
1966
bzrlib.trace.note('broken pipe')
1969
bzrlib.trace.log_exception('terminated by exception')
1978
1973
if __name__ == '__main__':