Was checking the command flow run list and noticed 2 things that are not quite optimal.
-
Noticed that the command flow run list is modifying the result. We copy the startTime and status to another place in the result. This for the simple reason that these are defaultProperties and thus won't work when they are in a nested object. According to me it's quite pointless to have 2 the same properties in the result.
Therefore I suggest that we perform an output check, and if we should modify the output (text, csv), that we return a custom response with all defaultProperties in it. If this is not the case, just return the original result
-
We only log the result if we get at least 1 flow run returned. If there are no runs returned, we simply log an error and that's it.
According to me, if there were no flow runs found, we should just log an empty array and that's it, it's quite hard to use this command in a script if it can return either an array or an error.
The code right now:
|
if (this.items.length > 0) { |
|
this.items.forEach(i => { |
|
i.startTime = i.properties.startTime; |
|
i.status = i.properties.status; |
|
}); |
|
|
|
logger.log(this.items); |
|
} |
|
else { |
|
if (this.verbose) { |
|
logger.logToStderr('No runs found'); |
|
} |
|
} |
Update:
Same goes for following commands:
- flow environment list
- flow environment get
Was checking the command
flow run listand noticed 2 things that are not quite optimal.Noticed that the command
flow run listis modifying the result. We copy the startTime and status to another place in the result. This for the simple reason that these are defaultProperties and thus won't work when they are in a nested object. According to me it's quite pointless to have 2 the same properties in the result.Therefore I suggest that we perform an output check, and if we should modify the output (text, csv), that we return a custom response with all defaultProperties in it. If this is not the case, just return the original result
We only log the result if we get at least 1 flow run returned. If there are no runs returned, we simply log an error and that's it.
According to me, if there were no flow runs found, we should just log an empty array and that's it, it's quite hard to use this command in a script if it can return either an array or an error.
The code right now:
cli-microsoft365/src/m365/flow/commands/run/run-list.ts
Lines 56 to 68 in 97d58e0
Update:
Same goes for following commands: