libbe.command.util

class libbe.command.util.Completer(options)
libbe.command.util.assignees(bugdir)
libbe.command.util.bug_comment_from_user_id(bugdir, id)
libbe.command.util.comp_path(fragment=None)

List possible path completions for fragment.

libbe.command.util.complete_assigned(command, argument, fragment=None)
libbe.command.util.complete_bug_comment_id(command, argument, fragment=None, active_only=True, comments=True)
libbe.command.util.complete_bug_id(command, argument, fragment=None)
libbe.command.util.complete_command(command, argument, fragment=None)

List possible command completions for fragment.

command argument is not used.

libbe.command.util.complete_extra_strings(command, argument, fragment=None)
libbe.command.util.complete_path(command, argument, fragment=None)

List possible path completions for fragment.

libbe.command.util.complete_severity(command, argument, fragment=None)
libbe.command.util.complete_status(command, argument, fragment=None)
libbe.command.util.select_values(string, possible_values, name='unkown')

This function allows the user to select values from a list of possible values. The default is to select all the values:

>>> select_values(None, ['abc', 'def', 'hij'])
['abc', 'def', 'hij']

The user selects values with a comma-separated limit_string. Prepending a minus sign to such a list denotes blacklist mode:

>>> select_values('-abc,hij', ['abc', 'def', 'hij'])
['def']

Without the leading -, the selection is in whitelist mode:

>>> select_values('abc,hij', ['abc', 'def', 'hij'])
['abc', 'hij']

In either case, appropriate errors are raised if on of the user-values is not in the list of possible values. The name parameter lets you make the error message more clear:

>>> select_values('-xyz,hij', ['abc', 'def', 'hij'], name="foobar")
Traceback (most recent call last):
  ...
UserError: Invalid foobar xyz
  ['abc', 'def', 'hij']
>>> select_values('xyz,hij', ['abc', 'def', 'hij'], name="foobar")
Traceback (most recent call last):
  ...
UserError: Invalid foobar xyz
  ['abc', 'def', 'hij']

Next topic

libbe.comment

This Page