Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zliang-akamai committed Aug 8, 2023
1 parent 902bd1b commit 663af7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions linodecli/arg_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from linodecli import plugins

from .completion import bake_completions
from .helpers import pagination_args, register_args_shared
from .helpers import pagination_args_shared, register_args_shared


def register_args(parser):
Expand Down Expand Up @@ -121,7 +121,7 @@ def register_args(parser):
"--debug", action="store_true", help="Enable verbose HTTP debug output."
)

pagination_args(parser)
pagination_args_shared(parser)
register_args_shared(parser)

return parser
Expand Down
6 changes: 5 additions & 1 deletion linodecli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ def filter_markdown_links(text):
return result


def pagination_args(parser: ArgumentParser):
def pagination_args_shared(parser: ArgumentParser):
"""
Add pagination related arguments to the given
ArgumentParser that may be shared across the CLI and plugins.
"""
parser.add_argument(
"--page",
metavar="PAGE",
Expand Down
7 changes: 4 additions & 3 deletions linodecli/plugins/obj/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from linodecli.cli import CLI
from linodecli.configuration import _do_get_request
from linodecli.configuration.helpers import _default_thing_input
from linodecli.helpers import expand_globs, pagination_args
from linodecli.helpers import expand_globs, pagination_args_shared
from linodecli.plugins import PluginContext, inherit_plugin_args
from linodecli.plugins.obj.buckets import create_bucket, delete_bucket
from linodecli.plugins.obj.config import (
Expand Down Expand Up @@ -77,6 +77,7 @@


def flip_to_page(iterable: Iterable, page: int = 1):
"""Given a iterable object and return a specific iteration (page)"""
iterable = iter(iterable)
for _ in range(page - 1):
next(iterable)
Expand All @@ -91,7 +92,7 @@ def list_objects_or_buckets(
Lists buckets or objects
"""
parser = inherit_plugin_args(ArgumentParser(PLUGIN_BASE + " ls"))
pagination_args(parser)
pagination_args_shared(parser)

parser.add_argument(
"bucket",
Expand Down Expand Up @@ -357,7 +358,7 @@ def list_all_objects(
"""
# this is for printing help when --help is in the args
parser = inherit_plugin_args(ArgumentParser(PLUGIN_BASE + " la"))
pagination_args(parser)
pagination_args_shared(parser)

parsed = parser.parse_args(args)

Expand Down

0 comments on commit 663af7b

Please sign in to comment.