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

Side by Side Diff: grit/tool/interface.py

Issue 1442863002: Remove contents of grit's SVN repository. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 1 month 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 | « grit/tool/diff_structures.py ('k') | grit/tool/menu_from_parts.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 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 '''Base class and interface for tools.
7 '''
8
9
10 class Tool(object):
11 '''Base class for all tools. Tools should use their docstring (i.e. the
12 class-level docstring) for the help they want to have printed when they
13 are invoked.'''
14
15 #
16 # Interface (abstract methods)
17 #
18
19 def ShortDescription(self):
20 '''Returns a short description of the functionality of the tool.'''
21 raise NotImplementedError()
22
23 def Run(self, global_options, my_arguments):
24 '''Runs the tool.
25
26 Args:
27 global_options: object grit_runner.Options
28 my_arguments: [arg1 arg2 ...]
29
30 Return:
31 0 for success, non-0 for error
32 '''
33 raise NotImplementedError()
34
35 #
36 # Base class implementation
37 #
38
39 def __init__(self):
40 self.o = None
41
42 def SetOptions(self, opts):
43 self.o = opts
44
45 def Out(self, text):
46 '''Always writes out 'text'.'''
47 self.o.output_stream.write(text)
48
49 def VerboseOut(self, text):
50 '''Writes out 'text' if the verbose option is on.'''
51 if self.o.verbose:
52 self.o.output_stream.write(text)
53
54 def ExtraVerboseOut(self, text):
55 '''Writes out 'text' if the extra-verbose option is on.
56 '''
57 if self.o.extra_verbose:
58 self.o.output_stream.write(text)
OLDNEW
« no previous file with comments | « grit/tool/diff_structures.py ('k') | grit/tool/menu_from_parts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698