OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium 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 # that can be found in the LICENSE file. |
4 | 4 |
5 """Manages subcommands in a script. | 5 """Manages subcommands in a script. |
6 | 6 |
7 Each subcommand should look like this: | 7 Each subcommand should look like this: |
8 @usage('[pet name]') | 8 @usage('[pet name]') |
9 def CMDpet(parser, args): | 9 def CMDpet(parser, args): |
10 '''Prints a pet. | 10 '''Prints a pet. |
11 | 11 |
12 Many people likes pet. This command prints a pet for your pleasure. | 12 Many people likes pet. This command prints a pet for your pleasure. |
13 ''' | 13 ''' |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return command(parser, args[1:]) | 252 return command(parser, args[1:]) |
253 | 253 |
254 cmdhelp = self.enumerate_commands().get('help') | 254 cmdhelp = self.enumerate_commands().get('help') |
255 if cmdhelp: | 255 if cmdhelp: |
256 # Not a known command. Default to help. | 256 # Not a known command. Default to help. |
257 self._add_command_usage(parser, cmdhelp) | 257 self._add_command_usage(parser, cmdhelp) |
258 return cmdhelp(parser, args) | 258 return cmdhelp(parser, args) |
259 | 259 |
260 # Nothing can be done. | 260 # Nothing can be done. |
261 return 2 | 261 return 2 |
OLD | NEW |