Is there a way to wrap columns?
kenperkins opened this issue · 3 comments
kenperkins commented
I'd like to use Easy Table for Help text in a command line application.
Is there a way to have the output do something like:
Command Text
Help blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah
Foo blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah
And so forth...
eldargab commented
Do you mean something like this ?
var Table = require('easy-table')
function cmd (name, opts) {
console.log(name)
var t = new Table
opts(function (name, help) {
t.cell('pad', ' ')
t.cell('name', name)
t.cell('help', help)
t.newRow()
})
console.log(t.print())
console.log()
}
cmd('install', function (opt) {
opt('--help', 'Show help')
opt('--foo', 'Foo option')
opt('--bar', 'Enable bar')
})
install
--help Show help
--foo Foo option
--bar Enable bar
Also just in case did you have a look at commander?
kenperkins commented
Hm, sorry I never updated this, I don't even recall the root problem :)
eldargab commented
Never mind :)