Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / core / command_line.py
1 # Copyright 2014 The Chromium 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 import optparse
6
7
8 class Command(object):
9   @property
10   def name(self):
11     return self.__class__.__name__.lower()
12
13   @property
14   def description(self):
15     return self.__doc__
16
17   def AddCommandLineOptions(self, parser):
18     pass
19
20
21 class ArgparseCommand(Command):
22   def ProcessCommandLine(self, parser, args):
23     pass
24
25   def Run(self, args):
26     raise NotImplementedError()
27
28
29 # TODO: Convert everything to argparse.
30 class OptparseCommand(Command):
31   usage = ''
32
33   def CreateParser(self):
34     return optparse.OptionParser('%%prog %s %s' % (self.name, self.usage))
35
36   def ProcessCommandLine(self, parser, options, args):
37     pass
38
39   def Run(self, options, args):
40     raise NotImplementedError()