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

Side by Side Diff: shell/subcmds/workon_cmd.py

Issue 6250058: Split out the big chromite shell 'main.py' into lots of subfiles. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/chromite.git@master
Patch Set: Incorporated davidjames and sosa feedback. Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « shell/subcmds/shell_cmd.py ('k') | shell/utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 """Implementation of the 'workon' chromite command."""
6
7
8 import chromite.lib.cros_build_lib as cros_lib
9 from chromite.shell import subcmd
10
11
12 class WorkonCmd(subcmd.WrappedChrootCmd):
13 """Run cros_workon."""
14
15 def __init__(self):
16 """WorkonCmd constructor."""
17 # Just call the WrappedChrootCmd superclass, which does most of the work.
18 # Note that host version uses "./", since it's in src/scripts and not in the
19 # path...
20 super(WorkonCmd, self).__init__(
21 ['cros_workon-%s'], ['./cros_workon', '--host'],
22 need_args=True
23 )
24
25 def Run(self, raw_argv, *args, **kwargs):
26 """Run the command.
27
28 We do just a slight optimization to help users with a common typo.
29
30 Args:
31 raw_argv: Command line arguments, including this command's name, but not
32 the chromite command name or chromite options.
33 args: The rest of the positional arguments. See _DoWrappedChrootCommand.
34 kwargs: The keyword arguments. See _DoWrappedChrootCommand.
35 """
36 # Slight optimization, just since I do this all the time...
37 if len(raw_argv) >= 2:
38 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.')
40 raw_argv = raw_argv[:1] + [''] + raw_argv[1:]
41
42 super(WorkonCmd, self).Run(raw_argv, *args, **kwargs)
OLDNEW
« no previous file with comments | « shell/subcmds/shell_cmd.py ('k') | shell/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698