Improve viewvc-install's response to invalid arguments.

* viewvc-install: Move introductory info printing after argument passing, so
    that it is not shown if there is an argument parsing error.
  Catch GetoptError, and report nicely.
  Do not pass None to getopt where it wants a string.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1293 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
maxb 2006-03-26 20:23:14 +00:00
parent fe995627d3
commit 6b98e0a8ec
1 changed files with 7 additions and 3 deletions

View File

@ -283,16 +283,20 @@ def install_tree(src_path, dst_path, prompt_replace):
## MAIN
if __name__ == "__main__":
print INFO_TEXT
# option parsing
optlist, args = getopt.getopt(sys.argv[1:], None, ['prefix=', 'destdir='])
try:
optlist, args = getopt.getopt(sys.argv[1:], "", ['prefix=', 'destdir='])
except getopt.GetoptError, e:
Error("Invalid option", getopt.GetoptError, e)
for opt, arg in optlist:
if opt == '--prefix':
ROOT_DIR = arg
if opt == '--destdir':
DESTDIR = arg
## print greeting
print INFO_TEXT
## prompt for ROOT_DIR if none provided
if ROOT_DIR is None:
if sys.platform == "win32":