Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: mojo/devtools/common/mojo_run

Issue 1343933003: Don't hard-code usage string in mojo_run. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import logging 7 import logging
8 import sys 8 import sys
9 9
10 from devtoolslib import shell_arguments 10 from devtoolslib import shell_arguments
11 from devtoolslib import shell_config 11 from devtoolslib import shell_config
12 12
13 _USAGE = ("mojo_run "
14 "[--args-for=<mojo-app>] "
15 "[--content-handlers=<handlers>] "
16 "[--enable-external-applications] "
17 "[--disable-cache] "
18 "[--enable-multiprocess] "
19 "[--wait-for-debugger] "
20 "[--sky <mojo-app>|<mojo-app>] "
21 """
22
23 A <mojo-app> is a Mojo URL or a Mojo URL and arguments within quotes.
24 Example: mojo_run "mojo:js_standalone test.js".
25 <url-lib-path> is searched for shared libraries named by mojo URLs.
26 The value of <handlers> is a comma separated list like:
27 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler
28 """)
29
30 _DESCRIPTION = """Runner for Mojo applications. 13 _DESCRIPTION = """Runner for Mojo applications.
31 14
32 Any arguments not recognized by the script will be passed on as shell arguments. 15 Any arguments not recognized by the script will be passed on as shell arguments.
16
17 Important shell arguments include:
18 "--args-for=<mojo-app-url> <arguments>"
19 "--content-handlers=<handlers>"
20 "--enable-external-applications"
qsr 2015/09/15 09:28:01 I think this is dead.
ppi 2015/09/15 09:28:41 Done.
21 "--disable-cache"
22 "--enable-multiprocess"
23 "--wait-for-debugger"
24 "<mojo-app-url>"
25 "<mojo-app-url> <arguments>"
26
27 The value of <handlers> is a comma separated list like:
28 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler
33 """ 29 """
34 30
35
36 # Port on which the mojo:debugger http server will be available on the host 31 # Port on which the mojo:debugger http server will be available on the host
37 # machine. 32 # machine.
38 _MOJO_DEBUGGER_PORT = 7777 33 _MOJO_DEBUGGER_PORT = 7777
39 _DEFAULT_WM = 'https://core.mojoapps.io/kiosk_wm.mojo' 34 _DEFAULT_WM = 'https://core.mojoapps.io/kiosk_wm.mojo'
40 35
41 _LEGACY_WM_URL = 'mojo:window_manager' 36 _LEGACY_WM_URL = 'mojo:window_manager'
42 _WM_URL = 'https://core.mojoapps.io/window_manager.mojo' 37 _WM_URL = 'https://core.mojoapps.io/window_manager.mojo'
43 _DEBUGGER_URL = 'https://core.mojoapps.io/debugger.mojo' 38 _DEBUGGER_URL = 'https://core.mojoapps.io/debugger.mojo'
44 39
45 40
46 def _configure_debugger(shell): 41 def _configure_debugger(shell):
47 """Configures debugger.mojo to run and sets up port forwarding for its http 42 """Configures debugger.mojo to run and sets up port forwarding for its http
48 server if the shell is running on a device. 43 server if the shell is running on a device.
49 44
50 Returns: 45 Returns:
51 Arguments that need to be appended to the shell argument list in order to 46 Arguments that need to be appended to the shell argument list in order to
52 run with the debugger. 47 run with the debugger.
53 """ 48 """
54 shell.forward_host_port_to_shell(_MOJO_DEBUGGER_PORT) 49 shell.forward_host_port_to_shell(_MOJO_DEBUGGER_PORT)
55 return ['%s %d' % (_DEBUGGER_URL, _MOJO_DEBUGGER_PORT)] 50 return ['%s %d' % (_DEBUGGER_URL, _MOJO_DEBUGGER_PORT)]
56 51
57 52
58 def main(): 53 def main():
59 logging.basicConfig() 54 logging.basicConfig()
60 55
61 parser = argparse.ArgumentParser(usage=_USAGE, description=_DESCRIPTION) 56 parser = argparse.ArgumentParser(
57 formatter_class=argparse.RawDescriptionHelpFormatter,
58 description=_DESCRIPTION)
62 shell_config.add_shell_arguments(parser) 59 shell_config.add_shell_arguments(parser)
63 60
64 parser.add_argument('--embed', type=str, 61 parser.add_argument('--embed', type=str,
65 help='Url to be embedded in the window manager.') 62 help='Url to be embedded in the window manager.')
66 parser.add_argument('--window-manager', default=_DEFAULT_WM, 63 parser.add_argument('--window-manager', default=_DEFAULT_WM,
67 help='Window manager app to be mapped as ' 64 help='Window manager app to be mapped as '
68 'mojo:window_manager. By default it is ' + 65 'mojo:window_manager. By default it is ' +
69 _DEFAULT_WM) 66 _DEFAULT_WM)
70 parser.add_argument('--debugger', action="store_true", 67 parser.add_argument('--debugger', action="store_true",
71 help='Run debugger.mojo along with the app.') 68 help='Run debugger.mojo along with the app.')
(...skipping 26 matching lines...) Expand all
98 95
99 if script_args.verbose: 96 if script_args.verbose:
100 print "Shell arguments: " + str(shell_args) 97 print "Shell arguments: " + str(shell_args)
101 98
102 shell.run(shell_args) 99 shell.run(shell_args)
103 return 0 100 return 0
104 101
105 102
106 if __name__ == "__main__": 103 if __name__ == "__main__":
107 sys.exit(main()) 104 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698