diff --git a/SoftLayer/CLI/command.py b/SoftLayer/CLI/command.py index b4cbd768c..34c50e549 100644 --- a/SoftLayer/CLI/command.py +++ b/SoftLayer/CLI/command.py @@ -73,6 +73,7 @@ def get_command(self, ctx, cmd_name): else: return module + # # pylint: disable=unused-argument def format_usage(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None: """Formats and colorizes the usage information.""" self.ensure_env(ctx) @@ -85,6 +86,7 @@ def format_usage(self, ctx: click.Context, formatter: click.formatting.HelpForma self.console.print(f"Usage: [path]{ctx.command_path}[/] {' '.join(pieces)}") + # pylint: disable=unused-argument def format_help_text(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None: """Writes the help text""" text = self.help if self.help is not None else "" @@ -104,6 +106,7 @@ def format_epilog(self, ctx: click.Context, formatter: click.formatting.HelpForm self.console.print(epilog) self.format_commands(ctx, formatter) + # pylint: disable=unused-argument def format_options(self, ctx, formatter): """Prints out the options in a table format""" @@ -136,7 +139,9 @@ def format_options(self, ctx, formatter): self.console.print(options_table) + # pylint: disable=unused-argument def format_commands(self, ctx, formatter): + """Formats the command list for click""" commands = [] for subcommand in self.list_commands(ctx): cmd = self.get_command(ctx, subcommand) diff --git a/SoftLayer/CLI/formatting.py b/SoftLayer/CLI/formatting.py index b9eca571e..2c0e324fe 100644 --- a/SoftLayer/CLI/formatting.py +++ b/SoftLayer/CLI/formatting.py @@ -243,7 +243,10 @@ def confirm(prompt_str, default=False): default_str = 'n' prompt = '%s [y/N]' % prompt_str - ans = click.prompt(prompt, default=default_str, show_default=False) + try: + ans = click.prompt(prompt, default=default_str, show_default=False) + except click.exceptions.Abort: + return False if ans.lower() in ('y', 'yes', 'yeah', 'yup', 'yolo'): return True @@ -260,7 +263,10 @@ def no_going_back(confirmation): prompt = f"This action cannot be undone! Type '{confirmation}' or press Enter to abort" - ans = click.prompt(prompt, default='', show_default=False) + try: + ans = click.prompt(prompt, default='', show_default=False) + except click.exceptions.Abort: + return False if ans.lower() == str(confirmation).lower(): return True diff --git a/SoftLayer/CLI/object_storage/credential/__init__.py b/SoftLayer/CLI/object_storage/credential/__init__.py index f3bc2723a..82bfef311 100644 --- a/SoftLayer/CLI/object_storage/credential/__init__.py +++ b/SoftLayer/CLI/object_storage/credential/__init__.py @@ -17,6 +17,7 @@ def __init__(self, **attrs): click.MultiCommand.__init__(self, **attrs) self.path = os.path.dirname(__file__) + # pylint: disable=unused-argument def list_commands(self, ctx): """List all sub-commands.""" commands = [] @@ -28,6 +29,7 @@ def list_commands(self, ctx): commands.sort() return commands + # pylint: disable=unused-argument def get_command(self, ctx, cmd_name): """Get command for click.""" path = "%s.%s" % (__name__, cmd_name)