def _add_format_option(self, command, action):
"""
Add format option.
This option defines the format type of the command output. This
option is attached only on `ListCommand` and `RetrieveCommand`.
:param command: Command instance.
:param action: Action type, e.g. 'list', 'retrieve', etc.
"""
if action in self.READ_ACTIONS:
return click.option(
'--format', type=click.Choice(['json', 'table']),
default='json')(command)
评论列表
文章目录