Skip to content

Commit

Permalink
added comments to the argcompleter method
Browse files Browse the repository at this point in the history
  • Loading branch information
GueLaKais committed Jun 29, 2024
1 parent 954db3b commit 60df388
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions colcon_cargo/argcomplete_completer/cargo_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ def __init__(self): # noqa: D107
)

def get_completer(self, parser, *args, **kwargs): # noqa: D102
"""
Get the completer for Cargo arguments.
This method checks if the '--cargo-args' argument is present in the provided arguments.
If it is, it tries to import the ChoicesCompleter from the argcomplete package and returns
an instance of it with an empty list of choices. If the '--cargo-args' argument is not
present or the argcomplete package is not installed, it returns None.
Args:
parser: The argument parser.
*args: Positional arguments passed to the method.
**kwargs: Keyword arguments passed to the method.
Returns:
ChoicesCompleter or None: An instance of ChoicesCompleter with an empty list of choices,
or None if the '--cargo-args' argument is not present or the argcomplete package is not
installed.
"""
if "--cargo-args" not in args:
return None

Expand Down

0 comments on commit 60df388

Please sign in to comment.