How to use the knack.arguments.ArgumentsContext function in knack

To help you get started, we’ve selected a few knack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / knack / tests / test_deprecation.py View on Github external
def load_arguments(self, command):
                with ArgumentsContext(self, '') as c:
                    c.argument('arg1', options_list=['--arg', '-a'], required=False, type=int, choices=[1, 2, 3])
                    c.argument('arg2', options_list=['-b'], required=True, choices=['a', 'b', 'c'])

                super(DeprecationTestCommandLoader, self).load_arguments(command)
github microsoft / service-fabric-cli / src / sfctl / params.py View on Github external
arg_context.argument('upgrade_domain_delta_unhealthy_nodes', type=int)
        arg_context.argument('application_health_policies', type=json_encoded)

    with ArgumentsContext(self, 'cluster upgrade-update') as arg_context:
        arg_context.argument('replica_set_check_timeout', type=int)
        arg_context.argument('unhealthy_nodes', type=int)
        arg_context.argument('unhealthy_applications', type=int)
        arg_context.argument('app_type_health_map', type=json_encoded)
        arg_context.argument('delta_unhealthy_nodes', type=int)
        arg_context.argument('upgrade_domain_delta_unhealthy_nodes', type=int)
        arg_context.argument('app_health_map', type=json_encoded)

    with ArgumentsContext(self, 'rpm list') as arg_context:
        arg_context.argument('state_filter', type=int)

    with ArgumentsContext(self, 'compose upgrade') as arg_context:
        arg_context.argument('unhealthy_app', type=int)
        arg_context.argument('default_svc_type_health_map', type=json_encoded)
        arg_context.argument('svc_type_health_map', type=json_encoded)

    with ArgumentsContext(self, 'property put') as arg_context:
        arg_context.argument('value', type=json_encoded)

    with ArgumentsContext(self, 'is') as arg_context:
        # expect the parameter command_input in the python method as --command in commandline.
        arg_context.argument('command_input',
                             CLIArgumentType(options_list='--command'))
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / params.py View on Github external
SETTINGS,
            options_list=SETTINGS_OPTIONS,
            type=str,
            required=False,
            help=SETTINGS_HELP)
        arg_context.argument(
            'force',
            options_list=['--force', '-f'],
            type=bool,
            required=False,
            nargs='?',
            default=False,
            const=True,
            help='Override a previous login, if exists.')

    with ArgumentsContext(self, _DOWNLOAD) as arg_context:
        arg_context.argument(
            ENVIRONMENT,
            options_list=ENVIRONMENT_OPTIONS,
            type=str,
            required=False,
            help=ENVIRONMENT_HELP)
        arg_context.argument(
            CONNECTOR_ID,
            options_list=CONNECTOR_ID_OPTIONS,
            type=str,
            required=False,
            help=CONNECTOR_ID_HELP)
        arg_context.argument(
            'destination',
            options_list=['--dest', '-d'],
            type=str,
github microsoft / service-fabric-cli / src / sfctl / params.py View on Github external
arg_context.argument('max_percent_unhealthy_nodes', type=int)
        arg_context.argument('max_percent_unhealthy_apps', type=int)
        arg_context.argument('context', type=json_encoded)
        arg_context.argument('chaos_target_filter', type=json_encoded)

    with ArgumentsContext(self, 'chaos schedule set') as arg_context:
        arg_context.argument('version', type=int)
        arg_context.argument('chaos_parameters_dictionary', type=json_encoded)
        arg_context.argument('jobs', type=json_encoded)

    with ArgumentsContext(self, 'cluster health') as arg_context:
        arg_context.argument('nodes_health_state_filter', type=int)
        arg_context.argument('applications_health_state_filter', type=int)
        arg_context.argument('events_health_state_filter', type=int)

    with ArgumentsContext(self, 'node health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)

    with ArgumentsContext(self, 'application health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)
        arg_context.argument('deployed_applications_health_state_filter',
                             type=int)
        arg_context.argument('services_health_state_filter', type=int)

    with ArgumentsContext(self, 'application deployed-list') as arg_context:
        arg_context.argument('max_results', type=int)

    with ArgumentsContext(self, 'application deployed-health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)
        arg_context.argument('deployed_service_packages_health_state_filter',
                             type=int)
github microsoft / service-fabric-cli / src / sfctl / params.py View on Github external
with ArgumentsContext(self, 'application health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)
        arg_context.argument('deployed_applications_health_state_filter',
                             type=int)
        arg_context.argument('services_health_state_filter', type=int)

    with ArgumentsContext(self, 'application deployed-list') as arg_context:
        arg_context.argument('max_results', type=int)

    with ArgumentsContext(self, 'application deployed-health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)
        arg_context.argument('deployed_service_packages_health_state_filter',
                             type=int)

    with ArgumentsContext(self, 'service health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)
        arg_context.argument('partitions_health_state_filter', type=int)

    with ArgumentsContext(self, 'service resolve') as arg_context:
        arg_context.argument('partition_key_type', type=int)

    with ArgumentsContext(self, 'partition health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)
        arg_context.argument('replicas_health_state_filter', type=int)

    with ArgumentsContext(self, 'replica health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)

    with ArgumentsContext(self, 'service package-health') as arg_context:
        arg_context.argument('events_health_state_filter', type=int)
github microsoft / service-fabric-cli / src / sfctl / params.py View on Github external
arg_context.argument('state_filter', type=int)

    with ArgumentsContext(self, 'compose upgrade') as arg_context:
        arg_context.argument('unhealthy_app', type=int)
        arg_context.argument('default_svc_type_health_map', type=json_encoded)
        arg_context.argument('svc_type_health_map', type=json_encoded)

    with ArgumentsContext(self, 'property put') as arg_context:
        arg_context.argument('value', type=json_encoded)

    with ArgumentsContext(self, 'is') as arg_context:
        # expect the parameter command_input in the python method as --command in commandline.
        arg_context.argument('command_input',
                             CLIArgumentType(options_list='--command'))

    with ArgumentsContext(self, 'mesh') as arg_context:
        arg_context.argument('application_resource_name',
                             options_list=('--app-name', '--application-name'),
                             help="The name of the application")
        arg_context.argument('service_resource_name', options_list=('--service-name'),
                             help="The name of the service")

    with ArgumentsContext(self, 'mesh app') as arg_context:
        arg_context.argument('application_resource_name', options_list=('--name', '-n'),
                             help="The name of the application")

    with ArgumentsContext(self, 'mesh service') as arg_context:
        arg_context.argument('service_resource_name', options_list=('--name', '-n'),
                             help="The name of the service")

    with ArgumentsContext(self, 'mesh service-replica') as arg_context:
        arg_context.argument('replica_name', options_list=('--name', '-n'),
github microsoft / service-fabric-cli / src / sfctl / params.py View on Github external
with ArgumentsContext(self, 'node list') as arg_context:
        arg_context.argument('max_results', type=int)

    with ArgumentsContext(self, 'application list') as arg_context:
        arg_context.argument('application_definition_kind_filter', type=int)
        arg_context.argument('max_results', type=int)

    with ArgumentsContext(self, 'application upgrade') as arg_context:
        arg_context.argument('parameters', type=json_encoded)
        arg_context.argument('default_service_health_policy',
                             type=json_encoded)
        arg_context.argument('service_health_policy', type=json_encoded)
        arg_context.argument('replica_set_check_timeout', type=int)
        arg_context.argument('max_unhealthy_apps', type=int)

    with ArgumentsContext(self, 'service create') as arg_context:
        arg_context.argument('instance_count', type=int)
        arg_context.argument('target_replica_set_size', type=int)
        arg_context.argument('min_replica_set_size', type=int)
        arg_context.argument('replica_restart_wait', type=int)
        arg_context.argument('quorum_loss_wait', type=int)
        arg_context.argument('stand_by_replica_keep', type=int)
        arg_context.argument('load_metrics', type=json_encoded)
        arg_context.argument('placement_policy_list', type=json_encoded)
        arg_context.argument('scaling_policies', type=json_encoded)

    with ArgumentsContext(self, 'service update') as arg_context:
        arg_context.argument('instance_count', type=int)
        arg_context.argument('target_replica_set_size', type=int)
        arg_context.argument('min_replica_set_size', type=int)
        arg_context.argument('load_metrics', type=json_encoded)
        arg_context.argument('scaling_policies', type=json_encoded)
github Azure / azure-devops-cli-extension / src / command_modules / vsts-cli-code / vsts / cli / code / arguments.py View on Github external
ac.argument('reviewers', nargs='+')

    with ArgumentsContext(cli_command_loader, 'code pr work-items') as ac:
        ac.argument('work_items', nargs='+')
        
    with ArgumentsContext(cli_command_loader, 'code pr update') as ac:
        ac.argument('auto_complete', **enum_choice_list(_ON_OFF_SWITCH_VALUES))
        ac.argument('squash', **enum_choice_list(_ON_OFF_SWITCH_VALUES))
        ac.argument('delete_source_branch', **enum_choice_list(_ON_OFF_SWITCH_VALUES))
        ac.argument('bypass_policy', **enum_choice_list(_ON_OFF_SWITCH_VALUES))
        ac.argument('transition_work_items', **enum_choice_list(_ON_OFF_SWITCH_VALUES))

    with ArgumentsContext(cli_command_loader, 'code pr policies') as ac:
        ac.argument('evaluation_id', options_list=('--evaluation-id', '-e'))

    with ArgumentsContext(cli_command_loader, 'code pr set-vote') as ac:
        ac.argument('vote', **enum_choice_list(_VOTE_VALUES))

    with ArgumentsContext(cli_command_loader, 'code repo') as ac:
        ac.argument('repo_id', options_list='--id')
github Azure / azure-cli-dev-tools / azdev / params.py View on Github external
for scope in ['extension add', 'extension remove', 'extension build', 'extension publish']:
        with ArgumentsContext(self, scope) as c:
            c.positional('extensions', metavar='NAME', nargs='+', help='Space-separated list of extension names.')

    for scope in ['extension repo add', 'extension repo remove']:
        with ArgumentsContext(self, scope) as c:
            c.positional('repos', metavar='PATH', nargs='+', help='Space-separated list of paths to Git repositories.')

    with ArgumentsContext(self, 'extension update-index') as c:
        c.positional('extensions', nargs='+', metavar='URL', help='Space-separated list of URLs to extension WHL files.')

    with ArgumentsContext(self, 'cli create') as c:
        c.positional('mod_name', help='Name of the module to create.')

    with ArgumentsContext(self, 'cli create') as c:
        c.ignore('local_sdk')

    with ArgumentsContext(self, 'extension create') as c:
        c.positional('ext_name', help='Name of the extension to create.')

    for scope in ['extension create', 'cli create']:
        with ArgumentsContext(self, scope) as c:
            c.argument('github_alias', help='Github alias for the individual who will be the code owner for this package.')
            c.argument('not_preview', action='store_true', help='Do not create template commands under a "Preview" status.')
            c.argument('required_sdk', help='Name and version of the underlying Azure SDK that is published on PyPI. (ex: azure-mgmt-contoso==0.1.0).', arg_group='SDK')
            c.argument('local_sdk', help='Path to a locally saved SDK. Use if your SDK is not available on PyPI.', arg_group='SDK')
            c.argument('client_name', help='Name of the Python SDK client object (ex: ContosoManagementClient).', arg_group='SDK')
            c.argument('operation_name', help='Name of the principal Python SDK operation class (ex: ContosoOperations).', arg_group='SDK')
            c.argument('sdk_property', help='The name of the Python variable that describes the main object name in the SDK calls (i.e.: account_name)', arg_group='SDK')
            c.argument('repo_name', help='Name of the repo the extension will exist in.')
            c.argument('display_name', arg_group='Help', help='Description to display in help text.')
github microsoft / service-fabric-cli / src / sfctl / params.py View on Github external
'Timeout does not include the time required to '
                                  'compress the application package. ')

    with ArgumentsContext(self, 'application create') as arg_context:
        arg_context.argument('parameters', type=json_encoded)
        arg_context.argument('metrics', type=json_encoded)
        arg_context.argument('min_node_count', type=int)
        arg_context.argument('max_node_count', type=int)

    with ArgumentsContext(self, 'application deployed-list') as arg_context:
        arg_context.argument('max_results', type=int)

    with ArgumentsContext(self, 'node list') as arg_context:
        arg_context.argument('max_results', type=int)

    with ArgumentsContext(self, 'application list') as arg_context:
        arg_context.argument('application_definition_kind_filter', type=int)
        arg_context.argument('max_results', type=int)

    with ArgumentsContext(self, 'application upgrade') as arg_context:
        arg_context.argument('parameters', type=json_encoded)
        arg_context.argument('default_service_health_policy',
                             type=json_encoded)
        arg_context.argument('service_health_policy', type=json_encoded)
        arg_context.argument('replica_set_check_timeout', type=int)
        arg_context.argument('max_unhealthy_apps', type=int)

    with ArgumentsContext(self, 'service create') as arg_context:
        arg_context.argument('instance_count', type=int)
        arg_context.argument('target_replica_set_size', type=int)
        arg_context.argument('min_replica_set_size', type=int)
        arg_context.argument('replica_restart_wait', type=int)