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