Skip to content

Commit c61846d

Browse files
Fix StackStorm#5130 Issue with action help display when having ordered optional parameters
1 parent 6c6ac79 commit c61846d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

st2client/st2client/commands/action.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -1207,13 +1207,12 @@ def _get_parameter_sort_value(self, parameters, name):
12071207
If this attribute is not available, parameter is sorted based on the
12081208
name.
12091209
"""
1210-
parameter = parameters.get(name, None)
1211-
1212-
if not parameter:
1213-
return None
1214-
1215-
sort_value = parameter.get("position", name)
1216-
return sort_value
1210+
parameter = parameters.get(name)
1211+
if parameter:
1212+
position = parameter.get('position')
1213+
# Convert position to a string if it exists, otherwise use the name
1214+
return str(position) if position is not None else name
1215+
return None
12171216

12181217
def _get_inherited_env_vars(self):
12191218
env_vars = os.environ.copy()

0 commit comments

Comments
 (0)