<commit_before>#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
import argparse

from argcomplete.completers import FilesCompleter

from azure.mgmt.resource.resources.models import DeploymentMode
from azure.cli.commands import register_cli_argument, CliArgumentType
from azure.cli.commands.parameters import (resource_group_name_type,
                                           tag_type,
                                           tags_type,
                                           get_resource_group_completion_list)

from ._validators import validate_resource_type, validate_parent, resolve_resource_parameters

# BASIC PARAMETER CONFIGURATION

choices_deployment_mode = [e.value.lower() for e in DeploymentMode]

resource_type_type = CliArgumentType(
    help='The resource type in <namespace>/<type> format.',
    type=validate_resource_type,
    validator=resolve_resource_parameters
)

register_cli_argument('resource', 'resource_name', CliArgumentType(options_list=('--name', '-n')))
register_cli_argument('resource', 'api_version', CliArgumentType(help='The api version of the resource (omit for latest)', required=False))
register_cli_argument('resource', 'resource_provider_namespace', CliArgumentType(help=argparse.SUPPRESS, required=False))
register_cli_argument('resource', 'resource_type', resource_type_type)
register_cli_argument('resource', 'parent_resource_path', CliArgumentType(help='The parent resource type in <type>/<name> format.', type=validate_parent, required=False, options_list=('--parent',)))
register_cli_argument('resource', 'tag', tag_type)
register_cli_argument('resource', 'tags', tags_type)
register_cli_argument('resource move', 'ids', nargs='+')

register_cli_argument('resource provider', 'top', CliArgumentType(help=argparse.SUPPRESS))
register_cli_argument('resource provider', 'resource_provider_namespace', CliArgumentType(options_list=('--namespace', '-n'), help='the resource provider name, aka \'namespace\''))

register_cli_argument('resource group', 'resource_group_name', resource_group_name_type, options_list=('--name', '-n'))
register_cli_argument('resource group deployment', 'resource_group_name', arg_type=resource_group_name_type, completer=get_resource_group_completion_list)
register_cli_argument('resource group deployment', 'deployment_name', CliArgumentType(options_list=('--name', '-n'), required=True, help='The deployment name.'))
register_cli_argument('resource group deployment', 'parameters_file_path', completer=FilesCompleter())
register_cli_argument('resource group deployment', 'template_file_path', completer=FilesCompleter())
register_cli_argument('resource group deployment', 'mode', CliArgumentType(
    choices=choices_deployment_mode, type=str.lower,
    help='Incremental (only add resources to resource group) or Complete (remove extra resources from resource group)'))<commit_msg>add short alias -n for resource list (#663)<commit_after>#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
import argparse

from argcomplete.completers import FilesCompleter

from azure.mgmt.resource.resources.models import DeploymentMode
from azure.cli.commands import register_cli_argument, CliArgumentType
from azure.cli.commands.parameters import (resource_group_name_type,
                                           tag_type,
                                           tags_type,
                                           get_resource_group_completion_list)

from ._validators import validate_resource_type, validate_parent, resolve_resource_parameters

# BASIC PARAMETER CONFIGURATION

choices_deployment_mode = [e.value.lower() for e in DeploymentMode]

resource_type_type = CliArgumentType(
    help='The resource type in <namespace>/<type> format.',
    type=validate_resource_type,
    validator=resolve_resource_parameters
)

resource_name_type = CliArgumentType(options_list=('--name', '-n'))
register_cli_argument('resource', 'resource_name', resource_name_type)
register_cli_argument('resource', 'api_version', CliArgumentType(help='The api version of the resource (omit for latest)', required=False))
register_cli_argument('resource', 'resource_provider_namespace', CliArgumentType(help=argparse.SUPPRESS, required=False))
register_cli_argument('resource', 'resource_type', resource_type_type)
register_cli_argument('resource', 'parent_resource_path', CliArgumentType(help='The parent resource type in <type>/<name> format.', type=validate_parent, required=False, options_list=('--parent',)))
register_cli_argument('resource', 'tag', tag_type)
register_cli_argument('resource', 'tags', tags_type)
register_cli_argument('resource list', 'name', resource_name_type)
register_cli_argument('resource move', 'ids', nargs='+')


register_cli_argument('resource provider', 'top', CliArgumentType(help=argparse.SUPPRESS))
register_cli_argument('resource provider', 'resource_provider_namespace', CliArgumentType(options_list=('--namespace', '-n'), help='the resource provider name, aka \'namespace\''))

register_cli_argument('resource group', 'resource_group_name', resource_group_name_type, options_list=('--name', '-n'))
register_cli_argument('resource group deployment', 'resource_group_name', arg_type=resource_group_name_type, completer=get_resource_group_completion_list)
register_cli_argument('resource group deployment', 'deployment_name', CliArgumentType(options_list=('--name', '-n'), required=True, help='The deployment name.'))
register_cli_argument('resource group deployment', 'parameters_file_path', completer=FilesCompleter())
register_cli_argument('resource group deployment', 'template_file_path', completer=FilesCompleter())
register_cli_argument('resource group deployment', 'mode', CliArgumentType(
    choices=choices_deployment_mode, type=str.lower,
    help='Incremental (only add resources to resource group) or Complete (remove extra resources from resource group)'))
{'fraction_non_alphanumeric': 0.15930696105489114, 'fraction_numerical': 0.00045998160073597056, 'mean_word_length': 4.532654792196777, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5329382', 'n_tokens_mistral': 1666, 'n_tokens_neox': 1632, 'n_words': 382}