Comments (7)
@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?
from core.
@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()
from core.
Thank you for the quick response @mdonnalley! I appreciate the workaround, but in my use case I also use the tee
command to route stdout when the SpinnerAction class is being used as well. If I append the \n
in my code, that works wonderfully for when the SimpleAction class is used, but then I get extra newlines when using SpinnerAction.
I will go ahead and work on a PR to update the API for you all to review. Appreciate it again!
from core.
@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. ActionBase
already has a getter for status
, which can only take a single parameter. Changing it to a method with multiple parameters will mean that developers will have to change ux.action.status = foo
to ux.action.status('foo', {newLine: true})
But maybe I'm not understanding what you plan to do
from core.
@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 setStatus
which would allow this to be a non-breaking change. I am not the biggest fan of introducing the setProperty
pattern, but it's the only solution I can think of that would allow the behavior without breaking the existing api.
If this is something you would consider, let me know, if not, no worries and thank you for your time regardless!
from core.
That is great with me, thank you!
from core.
@ClayChipps Just FYI - I'm going to close this issue (and the PR) because we've decided to drop the ux
module in the next major version. There are much better dedicated libraries for these kinds of things and we're recommending that people switch to those.
from core.
Related Issues (20)
- topicSeparator space generates wrong message when used alongside usage HOT 1
- Upgrading to a version after 3.20.0 causes issues with hooks HOT 3
- (help): show arg/flag options if user didn't provide any HOT 1
- Command summary displays as topic summary when nested below topic without summary. HOT 1
- Unable to run dev.js outside of the project folder
- BaseCommand Documentation HOT 3
- Errors on command load should throw errors instead of invalidating the command HOT 6
- [BUG]The issue of ux.prompt handling special characters. HOT 3
- Can't run development mode with bun HOT 2
- RangeError on ux.table when column starts with emoji HOT 1
- ux.Table: Incorrect parsing of double quotes when exporting to CSV HOT 3
- ux.table `maxWidth` column option HOT 2
- CliUx.ux.prompt text truncation HOT 3
- Build failure with `exactOptionalPropertyTypes` enabled HOT 5
- [Feature request] Alias a single flag to a set of multiple flags HOT 1
- Getting MaxListenersExceededWarning: Possible EventEmitter memory leak detected. after updating to latest version of oclif HOT 2
- Error bundling @oclif/core into my project HOT 15
- UX tables get displayed along with json output on usage of --json flag HOT 2
- Specify different oclif options for dev and run HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.