Skip to content

Conversation

@prmukherj
Copy link
Collaborator

@prmukherj prmukherj commented Oct 30, 2025

Context

'get_specs' was used for generating the dynamic help.

Change Summary

Dynamic help does not depend on 'get_specs' any longer.

Rationale

Dynamic help is constructed via attribute query as required.

Impact

Mostly no impact on the end users as the help text is expected to remain same.

PyCommand:

Command: Execute
  Supported keyword arguments:
  Bool: Force
    Currently active: True
    Default value: False
  Return type: Logical
  
Example usage: 
  Execute(Force=False)

PyCommandArguments:

Bool: Force
  Currently active: True
  Default value: False

@github-actions github-actions bot added the enhancement Improve any current implemented feature label Oct 30, 2025
help_lines.extend(
[" " + line for line in param._get_help_string().splitlines()]
)
elif isinstance(self, PyParameter):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just override it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will do.

cls_name = self.__class__.__name__
is_task_object = cls_name == "_TaskObject"

if is_task_object:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the PyParameter comment below, this should also be handled polymorphically, or at least externally (a type-based strategy).

name = str(self).split()[0].split(".")[-1]
default_val = getattr(self, "default_value", None)
default = default_val() if callable(default_val) else None
if isinstance(self, PyTextual):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of these conditions can be handled via an override per type.

Comment on lines +1141 to +1142
default_val = getattr(self, "default_value", None)
default = default_val() if callable(default_val) else None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what's going on here. Can we please have some comments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, sure. If the default value returns something then we add it. Will add some inline comments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, "default_val" can either be the attr or None. In the next line, it checks if it is not None then return the value of "default_val". Will simplify the logic as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve any current implemented feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants