azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Commands registered with `show_command` don't show formatting properly

Open djyou opened this issue 8 years ago • 2 comments

Describe the bug Commands registered with show_command and generic_update_command (and maybe others) are not picking up table_transformer from their command group.

To Reproduce For example, if the command type is registered as

    acr_custom_util = CliCommandType(
        operations_tmpl='azure.cli.command_modules.acr.custom#{}',
        table_transformer=registry_output_format,
        client_factory=cf_acr_registries
    )

And the following command has table_transformer inherited from acr_custom_util

    with self.command_group('acr', acr_custom_util) as g:
        g.command('show', 'acr_show')

But the following command doesn't

        g.show_command('show', 'acr_show')

A workaround does exist to attach table transformer to each command but seems redundant.

        g.show_command('show', 'acr_show', table_transformer=registry_output_format)

Expected behavior All command registrations should inherit settings utils from command group by default.

Environment summary Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

Additional context Add any other context about the problem here.

djyou avatar Aug 31 '18 00:08 djyou

/cc @ankurkhemani

djyou avatar Aug 31 '18 00:08 djyou

@williexu please take a look.

tjprescott avatar Aug 31 '18 14:08 tjprescott