Skip to content
Myr

add repr to Command

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jimmy Zeng · committed by David Lord · parent 856f0b7 · Browse files · 3 files+24 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+24 added−0 removed

  • tests:+18 added−0 removed
  • other:+6 added−0 removed

3 files+24 added−0 removed

modified:click/core.py+3 added
830 unmodified lines
831 self.no_args_is_help = no_args_is_help832 self.hidden = hidden833 self.deprecated = deprecated834835 def __repr__(self):836 return '<%s %s>' % (self.__class__.__name__, self.name)837838 def get_usage(self, ctx):839 """Formats the usage line into a string and returns it.840841 Calls :meth:`format_usage` internally.
1057 unmodified lines
modified:tests/test_basic.py+18 added
21 unmodified lines
22 assert 'I EXECUTED' in result.output23 assert result.exit_code == 0242526def test_repr():27 @click.command()28 def command():29 pass3031 @click.group()32 def group():33 pass3435 @group.command()36 def subcommand():37 pass3839 assert repr(command) == '<Command command>'40 assert repr(group) == '<Group group>'41 assert repr(subcommand) == '<Command subcommand>'424344def test_return_values():45 @click.command()46 def cli():47 return 42
507 unmodified lines
modified:CHANGES.rst+3 added
56 unmodified lines
57 ``click.edit()``. :pr:`1469`58- Arguments to system calls such as the executable path passed to59 ``click.edit`` can contains spaces. :pr:`1470`60- Add ZSH completion autoloading and error handling. :issue:`1348`61- Add a repr to ``Command``, showing the command name for friendlier62 debugging. :issue:`1267`636465Version 7.066-----------6768Released 2018-09-25
538 unmodified lines