-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SimpleAction does not write newline for status change #918
Comments
@ClayChipps I'm not opposed to changing the API to make the new line behavior configurable but it's worth noting that the easiest way to resolve this is to put a new line at the end of all your status updates: ux.action.start('Uploading files', 'Initializing\n', {stdout: true})
ux.action.status = 'Completed: 0. Size: 1 Pending: 0\n'
ux.action.status = 'Completed: 0. Size: 1 Pending: 1\n'
ux.action.status = 'Completed: 0. Size: 2 Pending: 1\n'
ux.action.status = 'Completed: 2. Size: 1 Pending: 1\n'
ux.action.stop() |
Thank you for the quick response @mdonnalley! I appreciate the workaround, but in my use case I also use the I will go ahead and work on a PR to update the API for you all to review. Appreciate it again! |
@ClayChipps I'm taking a closer look at your proposal and based on my understanding I'm not sure how it will be possible without introducing a breaking change. But maybe I'm not understanding what you plan to do |
@mdonnalley You are totally right, when I initially thought of the proposal I glossed over that we can't add a method with the same name as it is already defined as a getter/setter. I agree that changing this would constitute a breaking change, so I am onboard with NOT doing that. At this point I feel that your suggested workaround is probably the better option (for this somewhat limited usecase), but I did open #920 as a possibility. I defined a new method If this is something you would consider, let me know, if not, no worries and thank you for your time regardless! |
@ClayChipps If it's okay with you, let's stick with the workaround for now but we'll leave the issue and PR open in case others want to upvote them or chime in with other ideas. Does that work for you? |
That is great with me, thank you! |
@ClayChipps Just FYI - I'm going to close this issue (and the PR) because we've decided to drop the |
Describe the bug
Currently, when updating the status of a cli-ux action that is using the underlying SimpleAction class, the status updates do not trigger a newline at the end of the string.
This is because the SimpleAction class only calls the
_flush
function when thenewline
arg of the_updateStatus
function is true. The issue with this is that the_updateStatus
function defined within the ActionBase class only takes 2 parameters, and there is only a public setter defined for the status property. Thus, there is no way for a developer to specify to the SimpleAction class that they would like newlines generated for status updates.To Reproduce
Steps to reproduce the behavior:
"@oclif/core": "^3.15.0"
simple
actionType.Uploading files... InitializingUploading files... Completed: 0. Size: 1 Pending: 0Uploading files... Completed: 0. Size: 1 Pending: 1Uploading files... Completed: 0. Size: 2 Pending: 1Uploading files... Completed: 2. Size: 1 Pending: 1Uploading files... done
Expected behavior
For the status updates to be configured to appear on newlines.
Uploading files... Initializing Uploading files... Completed: 0. Size: 1 Pending: 0 Uploading files... Completed: 0. Size: 1 Pending: 1 Uploading files... Completed: 0. Size: 2 Pending: 1 Uploading files... Completed: 2. Size: 1 Pending: 1 Uploading files... done
Environment (please complete the following information):
Additional context
I am proposing to add a new function
status
to the ActionBase class defined asstatus(status, opts = {})
. We would then expand the_updateStatus
signature to 3 args._updateStatus(status, prevStatus, opts)
. This would maintain the current functionality and not introduce any breaking change while allowing developers to specify options when updating the status property.The text was updated successfully, but these errors were encountered: