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 Aug 19, 2024
1 parent 1b75568 commit 52e6001
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion colcon_cargo/argcomplete_completer/cargo_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,25 @@ def __init__(self): # noqa: D107
ArgcompleteCompleterExtensionPoint.EXTENSION_POINT_VERSION, '^1.0')

def get_completer(self, parser, *args, **kwargs): # noqa: D102
if '--cargo-args' not in args:
"""
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

try:
Expand Down

0 comments on commit 52e6001

Please sign in to comment.