357
357
summary, then a complete description of the command. A grammar
358
358
description will be inserted.
361
Other accepted names for this command.
364
List of argument forms, marked with whether they are optional,
369
['to_location', 'from_branch?', 'file*']
371
'to_location' is required
372
'from_branch' is optional
373
'file' can be specified 0 or more times
376
List of options that may be given for this command. These can
377
be either strings, referring to globally-defined options,
378
or option objects. Retrieve through options().
381
If true, this command isn't advertised. This is typically
360
:cvar aliases: Other accepted names for this command.
362
:cvar takes_args: List of argument forms, marked with whether they are
363
optional, repeated, etc. Examples::
365
['to_location', 'from_branch?', 'file*']
367
* 'to_location' is required
368
* 'from_branch' is optional
369
* 'file' can be specified 0 or more times
371
:cvar takes_options: List of options that may be given for this command.
372
These can be either strings, referring to globally-defined options, or
373
option objects. Retrieve through options().
375
:cvar hidden: If true, this command isn't advertised. This is typically
382
376
for commands intended for expert users.
385
Command objects will get a 'outf' attribute, which has been
386
setup to properly handle encoding of unicode strings.
387
encoding_type determines what will happen when characters cannot
389
strict - abort if we cannot decode
390
replace - put in a bogus character (typically '?')
391
exact - do not encode sys.stdout
393
NOTE: by default on Windows, sys.stdout is opened as a text
394
stream, therefore LF line-endings are converted to CRLF.
395
When a command uses encoding_type = 'exact', then
396
sys.stdout is forced to be a binary stream, and line-endings
378
:cvar encoding_type: Command objects will get a 'outf' attribute, which has
379
been setup to properly handle encoding of unicode strings.
380
encoding_type determines what will happen when characters cannot be
383
* strict - abort if we cannot decode
384
* replace - put in a bogus character (typically '?')
385
* exact - do not encode sys.stdout
387
NOTE: by default on Windows, sys.stdout is opened as a text stream,
388
therefore LF line-endings are converted to CRLF. When a command uses
389
encoding_type = 'exact', then sys.stdout is forced to be a binary
390
stream, and line-endings will not mangled.
400
393
A string indicating the real name under which this command was
401
invoked, before expansion of aliases.
394
invoked, before expansion of aliases.
402
395
(This may be None if the command was constructed and run in-process.)
404
397
:cvar hooks: An instance of CommandHooks.
406
:ivar __doc__: The help shown by 'bzr help command' for this command.
399
:cvar __doc__: The help shown by 'bzr help command' for this command.
407
400
This is set by assigning explicitly to __doc__ so that -OO can
411
__doc__ = "My help goes here"
404
__doc__ = "My help goes here"
1277
1270
class Provider(object):
1278
'''Generic class to be overriden by plugins'''
1271
"""Generic class to be overriden by plugins"""
1280
1273
def plugin_for_command(self, cmd_name):
1281
'''Takes a command and returns the information for that plugin
1274
"""Takes a command and returns the information for that plugin
1283
1276
:return: A dictionary with all the available information
1284
for the requested plugin
1277
for the requested plugin
1286
1279
raise NotImplementedError
1289
1282
class ProvidersRegistry(registry.Registry):
1290
'''This registry exists to allow other providers to exist'''
1283
"""This registry exists to allow other providers to exist"""
1292
1285
def __iter__(self):
1293
1286
for key, provider in self.iteritems():