~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Paul Hummer
  • Date: 2009-03-31 18:10:31 UTC
  • mto: This revision was merged to the branch mainline in revision 318.
  • Revision ID: paul@canonical.com-20090331181031-gq43vh7xjg2za3l4
Moved command_line_parser out of serve branches and into gonfig.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
import sys
21
21
 
22
 
from optparse import OptionParser
23
 
 
24
22
from bzrlib.plugin import load_plugins
25
23
 
26
24
from paste import httpserver
30
28
from loggerhead import __version__
31
29
from loggerhead.apps.filesystem import (
32
30
    BranchesFromFileSystemRoot, UserBranchesFromFileSystemRoot)
 
31
from loggerhead.config import command_line_parser
33
32
from loggerhead.util import Reloader
34
33
from loggerhead.apps.error import ErrorHandlerApp
35
34
 
36
35
 
37
 
def command_line_parser():
38
 
    parser = OptionParser("%prog [options] <path>")
39
 
    parser.set_defaults(
40
 
        user_dirs=False,
41
 
        show_version=False,
42
 
        log_folder=None,
43
 
        )
44
 
    parser.add_option("--user-dirs", action="store_true", dest="user_dirs",
45
 
                      help="Serve user directories as ~user.")
46
 
    parser.add_option("--trunk-dir", metavar="DIR",
47
 
                      help="The directory that contains the trunk branches.")
48
 
    parser.add_option("--port", dest="user_port",
49
 
                      help=("Port Loggerhead should listen on "
50
 
                            "(defaults to 8080)."))
51
 
    parser.add_option("--host", dest="user_host",
52
 
                      help="Host Loggerhead should listen on.")
53
 
    parser.add_option('--memory-profile', action='store_true',
54
 
                      dest='memory_profile',
55
 
                      help='Profile the memory usage using heapy.')
56
 
    parser.add_option("--prefix", dest="user_prefix",
57
 
                      help="Specify host prefix.")
58
 
    parser.add_option("--profile", action="store_true", dest="profile",
59
 
                      help="Generate callgrind profile data to "
60
 
                        "%d-stats.callgrind on each request.")
61
 
    parser.add_option("--reload", action="store_true", dest="reload",
62
 
                      help="Restarts the application when changing python"
63
 
                           " files. Only used for development purposes.")
64
 
    parser.add_option('--log-folder', dest="log_folder",
65
 
                      type=str, help="The directory to place log files in.")
66
 
    parser.add_option("--version", action="store_true", dest="show_version",
67
 
                      help="Print the software version and exit")
68
 
    return parser
69
 
 
70
 
 
71
36
def main(args):
72
37
    parser = command_line_parser()
73
38
    (options, args) = parser.parse_args(sys.argv[1:])