OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/python | |
sosa
2011/02/02 01:16:19
same
diandersAtChromium
2011/02/02 01:49:10
Done.
| |
2 # | |
3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 """Implementation of the 'workon' chromite command.""" | |
8 | |
9 | |
10 from chromite.lib import cros_build_lib as cros_lib | |
11 from chromite.shell import subcmd | |
12 | |
13 | |
14 class WorkonCmd(subcmd.WrappedChrootCmd): | |
15 """Run cros_workon.""" | |
16 | |
17 def __init__(self): | |
18 """WorkonCmd constructor.""" | |
19 # Just call the WrappedChrootCmd superclass, which does most of the work. | |
20 # Note that host version uses "./", since it's in src/scripts and not in the | |
21 # path... | |
22 super(WorkonCmd, self).__init__( | |
23 ['cros_workon-%s'], ['./cros_workon', '--host'], | |
24 need_args=True | |
25 ) | |
26 | |
27 def Run(self, raw_argv, *args, **kwargs): | |
28 """Run the command. | |
29 | |
30 We do just a slight optimization to help users with a common typo. | |
31 | |
32 Args: | |
33 raw_argv: Command line arguments, including this command's name, but not | |
34 the chromite command name or chromite options. | |
35 args: The rest of the positional arguments. See _DoWrappedChrootCommand. | |
36 kwargs: The keyword arguments. See _DoWrappedChrootCommand. | |
37 """ | |
38 # Slight optimization, just since I do this all the time... | |
39 if len(raw_argv) >= 2: | |
40 if raw_argv[1] in ('start', 'stop', 'list', 'list-all', 'iterate'): | |
41 cros_lib.Warning('OOPS, looks like you forgot a board name. Pick one.') | |
42 raw_argv = raw_argv[:1] + [''] + raw_argv[1:] | |
43 | |
44 super(WorkonCmd, self).Run(raw_argv, *args, **kwargs) | |
OLD | NEW |