Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Knack

------------

.. note:: 🚨 The project is in `initial development phase <https://semver.org/#how-should-i-deal-with-revisions-in-the-0yz-initial-development-phase>`__ . We recommend pinning to at least a specific minor version when marking **knack** as a dependency in your project.
.. note:: The project is in `initial development phase <https://semver.org/#how-should-i-deal-with-revisions-in-the-0yz-initial-development-phase>`__ . We recommend pinning to at least a specific minor version when marking **knack** as a dependency in your project.

------------

Expand Down
3 changes: 2 additions & 1 deletion knack/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def ignore(self, argument_dest):
:param argument_dest: The destination argument to apply the ignore type to
:type argument_dest: str
"""
self.argument(argument_dest, arg_type=ignore_type)
dest_option = ['--__{}'.format(argument_dest.upper())]
self.argument(argument_dest, arg_type=ignore_type, options_list=dest_option)

def extra(self, argument_dest, **kwargs):
"""Register extra parameters for the given command. Typically used to augment auto-command built
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = '0.3.1'
VERSION = '0.3.2'

DEPENDENCIES = [
'argcomplete',
Expand Down
16 changes: 16 additions & 0 deletions tests/test_command_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,22 @@ def test_register_extra_cli_argument(self):
command_metadata.arguments[existing].options)
self.assertTrue(contains_subset)

def test_register_ignore_cli_argument(self):
cl = CLICommandsLoader(self.mock_ctx)
command_name = 'test register sample-command'
with CommandGroup(cl, 'test register', '{}#{{}}'.format(__name__)) as g:
g.command('sample-command', '{}.{}'.format(TestCommandRegistration.__name__,
TestCommandRegistration.sample_command_handler.__name__))
with ArgumentsContext(cl, 'test register') as ac:
ac.argument('resource_name', options_list=['--this'])
with ArgumentsContext(cl, 'test register sample-command') as ac:
ac.ignore('resource_name')
ac.argument('opt_param', options_list=['--this'])
cl.load_arguments(command_name)
self.assertNotEqual(cl.command_table[command_name].arguments['resource_name'].options_list,
cl.command_table[command_name].arguments['opt_param'].options_list,
"Name conflict in options list")

def test_command_build_argument_help_text(self):
def sample_sdk_method_with_weird_docstring(param_a, param_b, param_c): # pylint: disable=unused-argument
"""
Expand Down