Closed Fa-b closed 5 years ago
OK, thanks for letting me know... yes, this lib was originally intended for use with the terminal but I'm open to the idea of changing that..
Could you send me a failing reproduction case please so I can see it failing and make sure I have a testable fix. Cheers.
Relatively new to this environment, how can I send you a reproduction case? Should I make a GitHub repository for a small Ionic 4 project showing the issue?
I don't know how to reproduce this out of the Ionic framework, maybe overwriting process.stdout = undefined?
In order to debug this issue i need to reproduce it - I have never used Ionic before so yes, would appreciate some help.. If you can't demonstrate the issue with Codepen or similar, please push a simple, failing Ionic project to either Github or Github Gists (https://gist.github.com/).
I tired Codepen, but I'm unable to load table-layout there.. Here is a GitHub repo with a very little effort reproduction project: https://github.com/Fa-b/table-layout_test
ok, thanks for showing me this issue.. Tbh, i haven't thought about making command-line-args/usage work in the browser before because it's not something anyone has ever asked for.. I think this particular bug (with table-layout) would be the first of many things which need fixing to get command-line-args working correctly in the browser.
command-line-args is a command-line tool for use in a Node.js context, are you 100% sure you need to be running it in a browser context?
I agree with you, for these reasons I would not consider my issue a bug. More a feature for it to work in Ionic as well. command-line-args/usage are working beautifully in my app! My browser application communicates with a node.js backend in order to access USB hardware. I have a 'virtual' CLI to send commands to the hardware and receive responses. Using command-line-args/usage saves me from implementing my own parser for the commands.
I'm using command-line-args and command-line-usage in my Ionic 4 browser app. It appears there is no process.stdout / stderr defined when using Ionic so table-layout fails on instantiation. Changing the following:
let ttyWidth = (process && (process.stdout.columns || process.stderr.columns)) || 0
to:let ttyWidth = (process.stdout && (process.stdout.columns || process.stderr.columns)) || 0
solves it. I think process will always be available?! Thanks for the beautiful libs @75lb