Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Network} az network nic create: Refine help message #13513

Merged
merged 3 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def get_folded_parameter_help_string(
display_name, allow_none=False, allow_new=False, default_none=False,
other_required_option=None):
other_required_option=None, allow_cross_sub=True):
""" Assembles a parameterized help string for folded parameters. """
quotes = '""' if platform.system() == 'Windows' else "''"

Expand All @@ -43,9 +43,10 @@ def get_folded_parameter_help_string(
# add parent name option string (if applicable)
if other_required_option:
help_text = '{} If name specified, also specify {}.'.format(help_text, other_required_option)
help_text = '{} If you want to use an existing {display_name} in other resource group or subscription, ' \
help_text = '{} If you want to use an existing {display_name} in other resource group{append_sub}, ' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly provide a sample output in the PR description.

'please provide the ID instead of the name of the {display_name}'.format(help_text,
display_name=display_name)
display_name=display_name,
append_sub= " or subscription" if allow_cross_sub else "")
return help_text


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def load_arguments(self, _):
nsg_help = get_folded_parameter_help_string('network security group', allow_none=True, default_none=True)
c.argument('network_security_group', help=nsg_help, completer=get_resource_name_completion_list('Microsoft.Network/networkSecurityGroups'))

subnet_help = get_folded_parameter_help_string('subnet', other_required_option='--vnet-name')
subnet_help = get_folded_parameter_help_string('subnet', other_required_option='--vnet-name', allow_cross_sub=False)
c.argument('subnet', help=subnet_help, completer=subnet_completion_list)

with self.argument_context('network nic update') as c:
Expand Down