Changeset 2741 for trunk/packages


Ignore:
Timestamp:
Dec 21, 2009, 12:22:22 AM (15 years ago)
Author:
price
Message:

invirt.fcgi: fix usage message, simplify option-parsing logic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-web/code/invirt.fcgi

    r2740 r2741  
    1414    argv0_dir = os.path.dirname(sys.argv[0])
    1515    print >>sys.stderr, """%s <unauth|auth> [config]
    16 %s/auth.fcgi [config]
    17 %s/unauth.fcgi [config]
    1816
    1917Run server as FastCGI, with CherryPy config from "main.conf".
    20 
    2118With `config`, run standalone with CherryPy config from `config`.
    2219
    23 Run this script as either 'auth.fcgi' or 'unauth.fcgi', to get
    24 the authenticated or unauthenticated site respectively, or pass
    25 'auth' or 'unauth' as the first parameter.
     20Serve the authenticated or unauthenticated site according to
     21the first argument.
     22
     23Helper scripts "auth.fcgi" and "unauth.fcgi" are provided to
     24facilitate running the server with no arguments.
    2625""" % (sys.argv[0], argv0_dir, argv0_dir)
    2726    sys.exit(2)
    2827
    2928if __name__ == "__main__":
    30     if len(sys.argv) > 3 or len(sys.argv) == 1 or '-h' in sys.argv or '--help' in sys.argv:
     29    if '-h' in sys.argv or '--help' in sys.argv:
    3130        usage()
     31    if not (2 <= len(sys.argv) <= 3):
     32        usage()
     33
     34    mode = sys.argv[1]
    3235    if len(sys.argv) == 3:
    33         mode = sys.argv[1]
    3436        conf_file = sys.argv[2]
    3537        dev = True
    3638    else:
    37         mode = sys.argv[1]
    3839        conf_file = os.path.join(base_dir, 'main.conf')
    3940
Note: See TracChangeset for help on using the changeset viewer.