Skip to content

Commit

Permalink
feat: adding link in missing/ additional argument description
Browse files Browse the repository at this point in the history
  • Loading branch information
clatapie committed Dec 12, 2024
1 parent 371003a commit fbc0c7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ library_name_structured: # Future name of the library
- pyconverter
- generatedcommands

subfolder:
subfolders:
- subfolder
- subsubfolder

Expand Down
25 changes: 13 additions & 12 deletions src/pyconverter/xml2py/ast_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
NO_RESIZE_LIST = ["Variablelist"]

MISSING_ARGUMENT_DESCRIPTION = """The description of the argument is missing in the Python function.
Please, refer to the product documentation for further information."""
Please, refer to the `command documentation <url>`_ for further information."""

ADDITIONAL_ARGUMENT_DESCRIPTION = """Additional arguments can be passed to the intial command.
Please, refer to the product documentation for further information."""
ADDITIONAL_ARGUMENT_DESCRIPTION = """Additional arguments can be passed to the initial command.
Please, refer to the `command documentation <url>`_ for further information."""


class NameMap:
Expand Down Expand Up @@ -2325,9 +2325,10 @@ def to_py_docstring(


class ArgumentList:
def __init__(self, py_name: str, list_entry: VarlistEntry, args: List) -> None:
def __init__(self, py_name: str, url: str, list_entry: VarlistEntry, args: List) -> None:

self._py_name = py_name
self._url = url
self._list_entry = list_entry
self._arguments = []
self._additional_args = []
Expand Down Expand Up @@ -2357,7 +2358,7 @@ def _parse_list_entry(self):
self._arguments.append(temp_args[initial_arg])
else:
self._arguments.append(
Argument(initial_arg, self._initial_args, MISSING_ARGUMENT_DESCRIPTION)
Argument(initial_arg, self._initial_args, MISSING_ARGUMENT_DESCRIPTION.replace("url", f"{self._url}"))
) # description is missing

is_additional_arg = False
Expand All @@ -2370,7 +2371,7 @@ def _parse_list_entry(self):
if is_additional_arg and "addional_command_arg" not in self.py_arg_names:
self._arguments.append(
Argument(
"addional_command_arg", self._initial_args, ADDITIONAL_ARGUMENT_DESCRIPTION
"addional_command_arg", self._initial_args, ADDITIONAL_ARGUMENT_DESCRIPTION.replace("url", f"{self._url}")
)
)

Expand All @@ -2392,7 +2393,7 @@ def __iadd__(self, argument_list):
else:
if initial_arg not in self.py_arg_names:
self._arguments.append(
Argument(initial_arg, self._initial_args, MISSING_ARGUMENT_DESCRIPTION)
Argument(initial_arg, self._initial_args, MISSING_ARGUMENT_DESCRIPTION.replace("url", f"{self._url}"))
)

is_additional_arg = False
Expand All @@ -2405,7 +2406,7 @@ def __iadd__(self, argument_list):
if is_additional_arg and "addional_command_arg" not in self.py_arg_names:
self._arguments.append(
Argument(
"addional_command_arg", self._initial_args, ADDITIONAL_ARGUMENT_DESCRIPTION
"addional_command_arg", self._initial_args, ADDITIONAL_ARGUMENT_DESCRIPTION.replace("url", f"{self._url}")
)
)

Expand Down Expand Up @@ -2501,17 +2502,17 @@ def arg_desc(self) -> List[Argument]:
for child in elem:
if isinstance(child, Variablelist):
if arguments is None:
arguments = ArgumentList(self.py_name, child, self.args)
arguments = ArgumentList(self.py_name, self.url, child, self.args)
else:
arguments += ArgumentList(self.py_name, child, self.args)
arguments += ArgumentList(self.py_name, self.url, child, self.args)

else:
for elem in refsyn:
if isinstance(elem, Variablelist):
if arguments is None:
arguments = ArgumentList(self.py_name, elem, self.args)
arguments = ArgumentList(self.py_name, self.url, elem, self.args)
else:
arguments += ArgumentList(self.py_name, elem, self.args)
arguments += ArgumentList(self.py_name, self.url, elem, self.args)

arg_file = Path("args.txt")

Expand Down

0 comments on commit fbc0c7a

Please sign in to comment.