cli-table / cli-table3 Goto Github PK
View Code? Open in Web Editor NEWPretty unicode tables for the command line
License: MIT License
Pretty unicode tables for the command line
License: MIT License
Hello, I found that when the number of rows is huge, I start to have some performance problems.
I have 1763 rows (5 columns) and it takes me 4473.023ms to run toString
method, I want to know if there is a way to improve the performance ?
Thank you!
Currently string-width@^4.0.0 is dependent on strip-ansi@^3.0.1,. which has a dependency on a vulnerable version of ansi-regex. The vulnerability is only fixed in ansi-regex >6.0.0, https://github.com/chalk/ansi-regex/releases/tag/v6.0.1
Vulnerability link - https://snyk.io/vuln/npm:ansi-regex
My code:
const table2 = new Table({style:{head:[],border:[]}});
table2.push(
[{rowSpan:5,content:1},{rowSpan:3,content:1},{colSpan: 5, content: 1}],
[{colSpan: 5, content: 1}],
[1,1,1,1,1],
[1,1,1,1,1,1],
[1,1,1,1,1,1]
)
console.log(table2.toString())
output:
┌───┬───┬───────────────────┐
│ 1 │ 1 │ 1 │
│ │ ├───────────────────┤
│ │ │ 1 │
│ │ ├───├───┬───┬───┬───┬───┤
│ │ │ 1 │ 1 │ 1 │ 1 │ 1 │ │
│ ├───┼───┼───┼───┼───┼───┤
│ │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │
│ ├───┼───┼───┼───┼───┼───┤
│ │ 1 │ 1 │ 1 │ 1 │ 1 │ 1 │
└───┴───┴───┴───┴───┴───┴───┘
error [email protected]: The engine "node" is incompatible with this module. Expected version "10.* || >= 12.*". Got "11.13.0"
The node version requirements is skipping v11. Is that on purpose? Does this not work on node 11.x or is there a bug in the requirement definitions?
https://github.com/cli-table/cli-table3/blob/master/package.json#L62
I see it has been changed in this commit aca5c8c
Hey there, I tried all versions of cli-table
i-e cli-table1
, cli-table2
& cli-table3
. All of them doesn't render the link properly.
This is the library i'm using terminal-link: Create clickable links in the terminal When i log it without cli-table3
it renders the link correctly. But when used inside the columns of cli-table
it doesn't render it and mess up the table borders. (Check the pic)
What do you think can be an issue? I think cli-table
is encoding the column's content which mess up the encoding provided by terminal-link
?
(90m should suppose to be the link) I'm using iterm2
Created pull request to update to cli-table3:
https://github.com/clusterworks/cdocker/pull/2
Hello,
I've noticed that there was a fix with emojis in the table when I experimented with the source. Will this change be pushed to npm? Thanks!
cli-table2
cli-table3
, particularly ensuring that the dependency in `package.json is updated to read:"cli-table3": "^0.5.0",
You can use the following copy as the title and description of your pull request:
Updates dependency cli-table2 to cli-table3
This PR updates the cli-table2 dependency to cli-table3, which fixes one of the npm audit warnings :)
cli-table2 (like cli-table itself) is no longer maintained. In jamestalmage/cli-table2#43 a couple of people have offered to take over maintenance but the current maintainer did not respond so as a result the project was forked to cli-table/cli-table3.
Hello,
my initialization code:
const statesTable = new Table({
head: ['ID', 'value', 'effects', 'Qs', 'Q result'],
colWidths: [6, 19, 10, 10, 19]
});
here're my rows:
[
[
{
"rowSpan": 2,
"content": "s_1"
},
{
"rowSpan": 2,
"content": "\"foo\""
},
"e_25",
"map\nmap*\nmutate",
"\"foo\""
],
[
"e_26",
"map\npipe*",
"\"foo\""
]
]
So, I'm wondering if I'm missing something. It looks like the empty cell on the second row shouldn't be there.
This code snippet produce such error from Typescript:
const resultTable = new Table({
head: ['', 'Assets ', 'Entries']
});
resultTable.push(
{ 'Previous values': [`100`, `200`] },
{ 'Normalized values': [`10`, `100`] }
);
Type 'string[]' is not assignable to type '(string & Cell[]) | (number & Cell[]) | (false & Cell[]) | (true & Cell[]) | (CellOptions & Cell[])'.
Type 'string[]' is not assignable to type 'CellOptions & Cell[]'.
Property 'content' is missing in type 'string[]' but required in type 'CellOptions'.ts(2322)
According to the documentation about cross table this code should be absolutely valid https://github.com/cli-table/cli-table3#cross-tables.
Could you check the typing for that case or maybe I'm wrong?
Typescript: 3.8.3
cli-table3: 0.6.0
Thank you for keeping this project active.
It would be great if headers could use same defaults that Cell can take. My current want is to center align a header when a cell text is longer than the heading:
Example:
const foo = new Table({
head: ['foo'],
}) as HorizontalTable;
foo.push(['something longer than the head']);
console.log(foo.toString());
I'd like something along these lines:
const foo = new Table({
head: [{ content: 'foo', hAlign: 'center' }],
}) as HorizontalTable;
foo.push(['something longer than the head']);
console.log(foo.toString());
which would get me:
HI guys,
I'm quite curious about this project, because I've been maintaining a backwards compatible alternative to cli-table that has possibly resolved some of the issues that would have caused you to fork its fork: cli-table2.
I see this chain of forks (cli-table/cli-table2/cli-table3) as a humorous, but sad microcosm of open source on Github. Feel free to cherry pick any of my source to apply it towards cli-table3, or perhaps you could create a tty-table2, tty-table3, etc like you have with cli-table here.
Also, headhunting the dependents of your parent forks via PR is a novel move. Nice.
I essentially want the same functionality as css' overflow-wrap: break-word;
Note wordWrap: true
does nothing here because there are no \n
chars in my string.
My current table code:
const Table = require('cli-table3')
let table = new Table({
'colWidths': [3, 36],
})
table.push([
'✔',
'stdout_specfile_display_spec_with_a_really_long_name_that_never_has_a_line_break_or_new_line.js',
])
console.log(table.toString())
Console output
I want to pass some option like: wordWrap: 'break-word
to the TableOptions and/or CellOptions so that I get this output from the code above
WHAT I WANT OUTPUT
Can I do this myself? Yes. Is it a PITA? Yes. 😞
Finding the points to insert newlines would be more convenient from within this library since it already is calculating how to wrapWords and knows the width of the columns/rows already.
Current list:
@allstar/allstar-cli
@builtioflow/connector-builder
@dasnoo/arsocket-server
@datapull/cli
@jaycenhorton/eth-gas-reporter
@koale/clichords
@mozheng-neal/github_cli
@practo/rev-replace-plugin
@secapps/cohesion
@simplrjs/azure-storage-backup
@sinchang/12306cli
@sleepez/shopkeeper
@synctree/libijs
@zf/jenkins-cli
airlane-hangar-cli
alive-push-cli
alphi
anypoint-cli
apigee-edge-cli
augmentable-cli
aws-env-manager
banana-log
baresoil-provider-aws
baresoil
basta
blocxus-test
cee
chrome-cli-win
cli-catarinense
cloudhub-cli
cmis-env-spa
cmis-package-server
coinrush
cointracker
crypto-coins
diabot
disclosure
doc-md-import
easytimes
embed-support
flowdock-deploy-notify
football-cli
fp-cli
gauge-cli
grid-cli
hsskgv
hubert
install-missing-require
installer-bench
json2csv-plus
juejin
license-checker-cli
litter-translator
loadmark
med-rn-cli
mykurisu-cli
nano-scripts
node-gitstar
node-qi
pada
panda-bin
pm2-jhonny
pm25-go
quixxi-cli
quran-cli2
qusandboxcli
qxf2006hf0216
r8s-cli
redcore-miniapp-cli
[Not on Github]scaleway-cmd
self-easy-template-cli
servicebus-trace
issue#52skgq
skgradver
skgv
sonarish-plugin-eslint-ruleset
ssh-host-manager
issue#51syncano-cli
time-tracker-cli
timesheet-cli
tntvillage
togen
toolbot-core-experiment
translate-hexon
travelchain-beta-ui
vtex
wm-check-blocks
yzz-node-query
Created pull request to update to cli-table3:
bigboat-io/cli#1
Opened a PR on json2csv and got the following error report from the maintainer:
zemirco/json2csv#302
Looks like node 4 and 5 don't work due to Block-scoped declarations (let, const, function, class) not yet supported outside strict mode.
Also color shows up in Node 8 and 9 but not in 6 and 7. We are testing against the > output without the colors, so tests fail in 8 and 9.
I guess we can publish the next release (should be a patch release or should we bump the minor version?).
TypeScript complains on table.push().
Here is a test code:
import Table from "cli-table3"
const table = new Table({
head: ["H1", "H2"]
})
table.push(["c1", "c2"])
console.log(table.toString())
Here is an error message:
tsc
src/t0-test.ts:6:1 - error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((...items: Cell[][]) => number) | ((...items: VerticalTableRow[]) => number) | ((...items: CrossTableRow[]) => number)' has no compatible call signatures.
6 table.push(["c1", "c2"])
~~~~~~~~~~~~~~~~~~~~~~~~
That code possible to compile and run with ts-ignore comment:
It will works:
// @ts-ignore
table.push(["c1", "c2"])
TypeScript version: 3.1.2
tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["es2017"],
"sourceMap": true,
"outDir": "./dist",
"strict": true,
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true
},
"include": ["src/**/*"]
}
The author of colors
is destroying the package (https://snyk.io/blog/open-source-npm-packages-colors-faker/)
It will be nice to remove colors
from the dependency to avoid vulnerability.
Can you create a Dynamic Tables so you can change something (in the array) and then reprint it without the table showing twice?
Hi,
Could we have an default option for the cell's text align please ?
... I mean instead of manually wrapping all the cell contents.
Thanks!
colors.js above 1.3.3 (as included in the package.json) is susceptible to the protest commit issued by the colors.js maintainer. Reverting to color.js release 1.3.3 should resolve the issue.
Hi, I was going to send a PR, but it seems the tests aren't actually being run. Instead, the code only gets linted:
$ jest --color
PASS lint test/cell-test.js
PASS lint test/table-layout-test.js
PASS lint test/utils-test.js
PASS lint src/cell.js
PASS lint src/utils.js
PASS lint examples/col-and-row-span-examples.js
PASS lint test/layout-manager-test.js
PASS lint test/original-cli-table-index-tests.js
PASS lint src/layout-manager.js
PASS lint examples/basic-usage-examples.js
PASS lint test/verify-legacy-compatibility-test.js
PASS lint lib/print-example.js
PASS lint test/table-test.js
PASS lint test/original-cli-table-newlines-test.js
PASS lint src/table.js
PASS lint scripts/print-examples.js
PASS lint test/example-tests.js
PASS lint scripts/update-docs.js
Test Suites: 18 passed, 18 total
Tests: 18 passed, 18 total
Snapshots: 0 total
Time: 2.037s
Ran all test suites.
✨ Done in 3.57s.
The last known good changeset I could find was 907b392.
In this revision:
$ jest --color
PASS test/example-tests.js
PASS test/cell-test.js
PASS test/verify-legacy-compatibility-test.js
PASS test/table-layout-test.js
PASS test/utils-test.js
PASS test/original-cli-table-index-tests.js
PASS test/table-test.js
PASS test/layout-manager-test.js
PASS test/original-cli-table-newlines-test.js
Test Suites: 9 passed, 9 total
Tests: 1 skipped, 243 passed, 244 total
Snapshots: 0 total
Time: 1.448s
Ran all test suites.
✨ Done in 2.45s.
I have created a issue on the repo on Bitbucket:
https://bitbucket.org/hitlist/allstar-cli/issues/1/update-cli-table2-to-cli-table3
I do not have all the Bitbucket things so, thought it was easiest to inform the author this way.
We should probably use @Turbo87 message he used for npm/npm#20955 as it clearly explains the situation. I am thinking that, if you are going to open a PR against one of the repos below, open a separate issue for it, and once the PR has merged, remove it from the list here? Thoughts?
This PR updates the
cli-table2
dependency tocli-table3
, which fixes one of thenpm audit
warnings :)
cli-table2
(likecli-table
itself) is no longer maintained. In jamestalmage/cli-table2#43 a couple of people have offered to take over maintenance but the current maintainer did not respond so as a result the project was forked to https://github.com/cli-table/cli-table3.
12g
(grrr-amsterdam/12g#8)2do-cli
(hosein2398/2do-cli#15)421752593pro
(looks like test repo)@0xcda7a/npm
@allstar/allstar-cli
@bigboat/cli
@builtioflow/connector-builder
@clusterworks/cdocker
@containership/containership.cli
@dasnoo/arsocket-server
@datapull/cli
@godaddy/jiractl
(godaddy/jiractl#3)@hsz/nsp
(archived)@idac/csvtools
(robations/csvtools#1)@jaycenhorton/eth-gas-reporter
@koale/clichords
@mozheng-neal/github_cli
@practo/rev-replace-plugin
@secapps/cohesion
@simplrjs/azure-storage-backup
@sinchang/12306cli
@sleepez/shopkeeper
@synctree/libijs
@zf/jenkins-cli
airlane-hangar-cli
alive-pension
(ks07/alive-pension#1)alive-push-cli-test
(deprecated)alive-push-cli
alks
(Cox-Automotive/alks-cli#93)allmighty-docker-manager
(RyanTheAllmighty/Allmighty-Docker-Manager#2)alphi
anypoint-cli
aozora
(fand/aozora#2)apigee-edge-cli
app-stats
(yenbekbay/app-stats#3)ashtin
(quoideneuf/ashtin#2)ast-flow-graph
(julianjensen/ast-flow-graph#5)augmentable-cli
aws-env-manager
banana-log
baresoil-provider-aws
baresoil
basta
beame-api
(deprecated)beelzebub
(jstty/beelzebub#58)blocxus-test
btc-cli
(https://github.com/kuwali/btc-cli/pull/1)bundle-size
(mkwtys/bundle-size#211)cee
cek-booking-kereta
(ayatmaulana/cekBookingKeretaCLI#3)censql
(https://github.com/Centiq/CenSQL/pull/3)chatdown
(microsoft/botbuilder-tools#244)chrome-cli-win
cli-catarinense
cli-retrospective
(ilbonzo/cli-retrospective#1)cli-weather
(pizzimathy/cli-weather#48)cloudhub-cli
cmis-env-spa
cmis-package-server
coinbase-value
(srdjanprpa/coinbase-value#2)coinboard
(teddylun/coinboard#2)coinmarketcap-info-cli
(roNn23/coinmarketcap-info-cli#2)coinmon
(https://github.com/bichenkk/coinmon/pull/57)coinmonhubpool
(villers/Coinmonhubpool#4)coinone-cli-temp
coinrush
cointracker
crypto-coins
crypto-info
cryptotracker
cs-go
csgo-cli
currency-rates
diabot
disclosure
dnsever-ddns-updater
doc-md-import
domain-cli
easytimes
embed-support
ember-module-migrator
esm-dep-check
exlist
fastack
flarectl
flowdock-deploy-notify
fooda
football-cli
fp-cli
gauge-cli
gcalendar-cli
geoapi-cli
getmethefuckthere
gh-shipit
gh-user-stats
github-deploy-notify
github-uploader
gradver
grid-cli
grunt-grizzly
gulp-cssdepth-check
gulp-print-spacesavings
gupiao
handwriting-io-cli
hdl-js
(DmitrySoshnikov/hdl-js@82e574b)hello_same
heq
hexo-theme-cli
hsskgv
hubert
hucomdic
imposibility-cli
install-missing-require
installer-bench
io-cep-cli
jira-cl
joomlascan
json2csv-plus
juejin
kml-cli
kzt
least-black
less-black
libijs
license-checker-cli
litter-translator
livid
ll1
loadmark
lomachenko
longview-data
luis-apis
(microsoft/botbuilder-tools#244)lxcjs
mastermind-game
med-rn-cli
mgmt-assets
mindstate
miner-manager
modclean-benchmark
moneda-cli
moro
movie-list
mykurisu-cli
nameplate
nano-scripts
nba-scoreboard
neterra-miner-agent
neterra-miner
newman-multiglobal
newman-reporter-newpost
newman-reporter-track-env-vars
noble-cli
node-aircrack
node-esp
node-gitstar
node-muzika
node-qi
not-bundled-npm
notebox
npm-compare
npm-consider
npm-downloads-count
npm5v
npmc
npms-cli
npmvsyarn
nsp-reporter-qc
nsp
(archived)nst-cli
ontap-cli
opsworks-instances
otterio-cli
overtime-cli
pada
panda-bin
pelias-interpolation
plexpy-cli
pm2-jhonny
pm25-go
power-aso
qnamaker
(microsoft/botbuilder-tools#244)quadrigacx-cli
quixxi-cli
quorra-cli
quran-cli2
qusandboxcli
qxf2006hf0216
r8s-cli
redcore-miniapp-cli
[Not on Github]relution-cli
rmdr
rnkit-code-push-cli
rss-o-bot
rtm-cli
sanctuary-benchmark
scaleway-cmd
seatgeek-cli
self-easy-template-cli
servicebus-trace
skgq
skgradver
skgv
soccer-go
soccertv
solat
sonarish-plugin-eslint-ruleset
speedo-cli
ssh-host-manager
stacks-cli
star-diff
syncano-cli
sysinternals
tacon
time-tracker-cli
timesheet-cli
tntvillage
togen
toolbot-core-experiment
touteta
translate-hexon
travelchain-beta-ui
tree-exec
trillium
turbostatus
tureng
tw-forex
twitch-helm
twitch-stream-cli
twse-cli
typeracer-cli
uappexplorer-cli
urcli
uvpm-cli
vgmpfdl
vinci
vtex
webcoach-zh
webpack-canary
wfhcli
what-do-i-depend-on
what-the-status-code-cli
whk
PR ~ (trevorlinton/whack#5)whoshome-cli
~ Project has not been updated in 2 years.wm-check-blocks
wmata
Project has not been updated in 2 years.workenv-cli
PR ~ (horacehylee/workenv-cli#1)xpfe-cli
pr - (excaliburhan/xpfe-cli#5)xrpcli
xrpmon
ysl
- Latest master no longer has cli-table2 as a dependencyyzz-node-query
- This was last published 2 years ago@blinkmobile/server-cli
(oneblink/server-cli#478)@civicwar/vscode-vem
(civicwar/vscode-vem#1)@dadi/boot
(dadi/boot#6)@denali-js/core
(denali-js/core#441)@digitaslbiparis/webcoach
(PublicisSapientParis/coach#5)@fly/fly
(superfly/fly#87)@frctl/fractal
(frctl/fractal#443)@google-cloud/functions-emulator
(googlearchive/cloud-functions-emulator#216)@neo-one/cli
(neo-one-suite/neo-one#188)@personalcapital/newman-reporter-csv
(deprecated)@radic/console
(https://github.com/RobinRadic/npm-packages/pull/3)@rhar/bonjour-browser
(ronny/bonjour-browser#1)@syncano/cli
(Syncano/syncano-node#238)appcd
(tidev/appc-daemon#332)appcenter-cli
(microsoft/appcenter-cli#451)ascr
(msikma/ascr#1)audit-age
(jaydenseric/audit-age#1)bash.origin.test
(bash-origin/bash.origin.test#5)beame-sdk
(beameio/beame-sdk#29)blockchain-cli
(0xs34n/blockchain-cli#23)blockfolio
(maxmill/blockfolio#4)boi-deploy
(boijs/boi-deploy#1)boi-kernel
(boijs/boi-kernel#2)boldr-config
(boldr/boldr-tools#8)bot18
(carlos8f/bot18#1)botonic
(hubtype/botonic#1)bottender
(Yoctol/bottender#284)bundle-outdated-formatter
(emsk/bundle-outdated-formatter#1)caporal
(mattallty/Caporal.js#115)certificates
(manishbhatias/certificates#1)cherry-cherry
(cyseria/cherry-cli#2)chexbox
(mattt416/chexbox#11)clapp
(MeLlamoPablo/clapp#20)clean-package-json
(vijaysutrave/clean-package-json#2)coinmarketcap-cli
(EricCrosson/coinmarketcap-cli#8)command-irail
(iRail/command-irail#2)containership.plugin.cloud
(https://github.com/containership/containership.plugin.cloud/pull/155)contentful-cli
(contentful/contentful-cli#44)contentful-export
(contentful/contentful-export#111)contentful-import
(contentful/contentful-import#105)cost-of-modules
(siddharthkp/cost-of-modules#52)ddv
(ddvjs/ddv#4)denali
(denali-js/core#441)devebot-cli
(devebot/devebot-cli#1)doclt
(omgimanerd/doclt#10)ds18b20-raspi
(thisdavej/ds18b20-raspi#1)eazydict
(keenwon/eazydict#5)ecs-aws
(samsoul007/ecs-aws#2)ember-cli-deploy-display-revisions
(ember-cli-deploy/ember-cli-deploy-display-revisions#21)ember-exam
(ember-cli/ember-exam#130)ember-try
(ember-cli/ember-try#198)eslint-index
(wagerfield/eslint-index#1)esti-mate-cli
(gsipos/esti-mate-cli#40)eth-gas-reporter
(cgewecke/eth-gas-reporter#78)eth-tools
(davidhq/eth-tools#1)expressjs-boilerplate
(360fy/expressjs-boilerplate#2)footballcli
(manrajgrover/football-cli#31)gemstone-tool
(gemstonejs/gemstone-tool#1)genet
(bucharest-gold/genet#19)ghost-cli
(TryGhost/Ghost-CLI#751)gluegun
(infinitered/gluegun#383)grank
(cdoco/grank#1)graphql-contract-test
(symm/graphql-contract-test#4)habitica-cli
(charlespwd/habitica-cli#4)hafas-cli
(derhuerst/hafas-cli#1)http-status-identifier-cli
(jaebradley/http-status-identifier-cli#30)jira-tool
(WillBrock/JiraTool#1)json2csv
(zemirco/json2csv#302)lisky
(LiskArchive/lisk-commander#546)loadtester
(ImpressTV/loadtester#2)milieu
(exact-payments/Milieu#24)mobile-center-cli
(microsoft/appcenter-cli#451)moneylover-cli
(leMaik/moneylover-cli#1)morphlingjs
(leboncoin/morphlingjs#9)moza
(nju33/moza#2)nba-go
(homerchen19/nba-go#77)newman-reporter-csv
(deprecated)newman
nfl-odds-cli
(https://github.com/msell/nfl-odds-cli/pull/1)nix-kubernetes
(xtruder/nix-kubernetes#19)npm-audit-report
(npm/npm-audit-report#24)npm
(npm/npm#20955)nsp-formatter-writefile
(ewanharris/nsp-formatter-writefile#1)peach-cli
(https://github.com/peachworks/Peach-CLI/pull/12)react-deploy
(sumn2u/react-deploy#1)react-prop-table
(ly-tools/react-prop-table#2)reaction-cli
(reactioncommerce/reaction-cli#74)regexp-tree
(DmitrySoshnikov/regexp-tree#160)remuxme
(remux-io/remuxme#4)requestbin-cli
(jaebradley/requestbin-cli#14)surge
(sintaxi/surge#336)syntax-cli
(DmitrySoshnikov/syntax#61)tagz
(teomurgi/tagz#1)ufp-core
(FrontendSolutionsGmbH/ufp-core-frontend#1)utilities-cli
(jaebradley/utilities-cli#14)v2ex-cli
(unix/v2ex-cli#15)webcoach
(sitespeedio/coach#292)wombat
(npm/wombat-cli#156)yarn-upgrade-on-ci
(htwroclau/yarn-upgrade-on-ci#1)zapier-platform-cli
(zapier/zapier-platform-cli#327)While I was working on the issue #28, after updating the code for the new version of cli-table, typescript threw at me the following error for the push method of the Table type.
Cannot invoke an expression whose type lacks a call signature. Type '((...items: Cell[][]) => number) | ((...items: VerticalTableRow[]) => number) | ((...items: CrossTableRow[]) => number)' has no compatible call signatures.
The method was called with proper signature, but it still throws the error.
It seems that the "Table" union type definition was created incorrectly, as Typescript prefers to wrap the generics with a single type instead of creating new ones for them.
I created a pull request for the suggested solution #53
I have signed up cli-table for GHA. So we can use it now.
Dear cli-table3 maintainers,
Thank you for your contribution to the open-source community.
This issue was automatically created to inform you a new npm maintainer has published version 0.6.1 of cli-table3.
Our service monitors the open-source ecosystem and informs popular packages' owners in case of potentially harmful activity.
If you find this behavior legitimate, kindly close and ignore this issue. Read more
I need the column to have an auto width (depends on content), but not more than maxWidth.
If you try to override padding-left
or padding-right
TableOptions style with a CellOptions style with 'padding-left': 0
or 'padding-right': 0
there is no effect.
The 0
values in the cell also do not override the default padding in cli-table3.
The padding-left
and padding-right
set to 0
does work fine in the TableOptions however. The bug is only in overriding the Table options
const Table = require('cli-table3')
let table = new Table({
'style': {
'padding-left': 1, // default Table option is padding 1
},
})
table.push([
{
content: 'a',
'style': {
'padding-left': 5, // padding 5 👍
},
},
{
content: 'b',
'style': {
'padding-left': 1, // padding 1 👍
},
},
{
content: 'c',
'style': {
'padding-left': 0, // padding 0 :( no effect
},
},
{
content: 'd',
'style': {
'padding-left': -1, // padding -1 kind of has 0 padding
// but then has to offset with colWidths 2 to work
},
},
])
console.log(table.toString())
Resulting table:
The tests do not cover a 0
case of padding here:
Line 150 in d22503b
This line is culprit:
Line 334 in d22503b
When padding-left in the Cell style options is a positive number (2) this is evaluating out as:
obj.paddingLeft =
cellStyleObj.paddingLeft || // evaluates to undefined
cellStyleObj[padding-left] || // evaluates to 2
tableStyleObj.paddingLeft || // evaluates to undefined
tableStyleObj.[padding-left] // evaluates to 1
// paddingLeft = 2 yay!!
When padding-left in the Cell style options is 0 this is evaluating out as:
obj.paddingLeft =
cellStyleObj.paddingLeft || // evaluates to undefined
cellStyleObj[padding-left] || // evaluates to 0
tableStyleObj.paddingLeft || // evaluates to undefined
tableStyleObj.[padding-left] // evaluates to 1
// paddingLeft = 1 oh no!!
I would love to submit a PR, but honestly I have no idea if I will have the time. Hopefully this is helpful!
cli-table2
cli-table3
, particularly ensuring that the dependency in `package.json is updated to read:"cli-table3": "^0.5.0",
You can use the following copy as the title and description of your pull request:
Updates dependency cli-table2 to cli-table3
This PR updates the cli-table2 dependency to cli-table3, which fixes one of the npm audit warnings :)
cli-table2 (like cli-table itself) is no longer maintained. In jamestalmage/cli-table2#43 a couple of people have offered to take over maintenance but the current maintainer did not respond so as a result the project was forked to cli-table/cli-table3.
On of the packages that depends on cli-table
is https://www.npmjs.com/package/@0xcda7a/npm
Not sure what to make of it. It is not the canonical npm
package so, not sure we should be doing anything about it. Thoughts? @Turbo87 @DanielRuf
My intention is to produce a table that looks like this:
┌────┬────┬────┐
│ A1 │ B1 │ C1 │
│ ├────┼────┤
│ │ B2 │ C2 │
│ │ ├────┤
│ │ │ C3 │
└────┴────┴────┘
For some reason, it looks like this:
┌────┬────┬────┐
│ A1 │ B1 │ C1 │
│ ├────┼────┤
│ │ B2 │ C2 │
│ │ ├────├────┤
│ │ │ C3 │ │
└────┴────┴────┴────┘
const tbl = new Table();
tbl.push([ { rowSpan: 3, content: 'A1' }, 'B1', 'C1'],
[ { rowSpan: 2, content: 'B2' }, 'C2'],
['C3']);
console.log(tbl.toString());
I can remove the extra column in this example by making the third row an empty array, but I do need to display 'C3'.
I saw PR 187, so I thought it is already fixed. I verified that I have the code, but still getting that extra column.
The library it's not updated anymore... node.js 6 is not maintained anymore and there are fixes that haven't been released yet.
Description:
Random Columns are generated on the 2 last lines.
Is this error from my code or something internally in the lib?
Code:
let table = new Table(({
head: ['Time', 'Mon', 'Tues', 'Wed', 'Thur', 'Fri']
}))
let period = ['Library', '.Net SK B1\nCG Lab VG B2\nDBMS SV B3', '.Net GC', 'TOC VP', 'DBMS SV', 'CG Lab VG B1\nDBMS SV B2\n.Net SK B3', 'IMP BP', 'CG YC','ID', 'DBMS SV B1\n.Net SK B2', 'CG LAB B3 VG', 'CG (TUT) YC', 'Club Activity', 'Mentor Meet'];
table.push(
['09:00 to 10:00', period[0], period[0], period[0], {rowSpan:3,content:period[1],vAlign:'center'}, period[2]],
['10:00 to 11:00', period[3], period[3], period[4], {rowSpan:3,content:period[5],vAlign:'center'}],
['11:00 to 12:00', period[6], period[7], period[3]],
['12:00 to 01:00', period[0], period[8], period[6], period[6]],
['01:00 to 02:00', {colSpan: 5, content: 'Lunch', hAlign: 'center'}],
['02:00 to 03:00', {rowSpan:3,content:period[9],vAlign:'center'},{rowSpan:3,content:period[10],vAlign:'center'}, period[3], period[2], period[4]],
['03:00 to 04:00', period[10], period[7], period[6]],
['04:00 to 05:00', period[3], period[11], period[12]]
);
console.log(table.toString())
I have reported this upstream in laravel-mix but also wanted to report it here. Given that colors is an optional dependency it may be best to simply remove it from this project. I read that colors and faker npm projects were both corrupted:
At the very least I would say ensure that this package specifies version 1.4.0 to prevent folks from downloading the corrupted version.
Full error:
RangeError: Invalid string length
at Array.join (<anonymous>)
at Table.toString (/Users/.../node_modules/cli-table3/src/table.js:59:19)
The table is pretty long, but I do need it. I'm wondering if there's something this library can do about this error. This comment in an atom editor issue seemed to have some useful info.
Here's the table as a text file:
range_error_invalid_string_length.txt
[Edit: Also, if this library can't deal with that error, what the longest a string can be?]
The version of string-width dependency, which has a dependency on strip-ansi, is using a vulnerable version of ansi-regex. Need to upgrade the dependency version in the package.json to 4.2.3 or to the 5.x.x family of string-width (latest is 5.1.0). https://github.com/sindresorhus/string-width/releases
Please check Marak/colors.js#289 for all details.
Looks like the color package is deliberately broken so all dependencies break on update.
Would it be possible for now to update the package.json file to lock the colors package to the last stable version: 1.4.0 ?
Hi,
Is it possible to have a dynamic width table based on the width of the terminal? I see that column widths are optional but this doesn't format the table as expected as pushes data outside of the bounds and setting a column width with a terminal that is too small pushes the data out of bounds:
Now if i set the column width but make the terminal smaller than the total width:
Thank you.
Would it be possible to have an option that removes empty cells and returns a table like this?
┌────────────────────┬───────────────────────┬────────────────┐
│ Guilds │ Channels │ Aprox. Users │
├────────────────────┼───────────────────────┼────────────────┤
│ 137 │ 4,838 │ 295,012 │
├────────────────────┼───────────────────────┼────────────────┤
│ Messages sent │ Messages received │ Commands used │
├────────────────────┼───────────────────────┼────────────────┤
│ 25 │ 190 │ 9,756 │
├────────────────────┼───────────────────────┼────────────────┤
│Highlights triggered│ Mentions │ Shard │
├────────────────────┼───────────────────────┼────────────────┤
│ 100,356 │ 0 │ not sharded │
├────────────────────┼───────────────────────┼────────────────┤
│ Uptime │ Uptime Percentage │ Memory Used │
├────────────────────┼───────────────────────┼────────────────┤
│ 3 minutes │5092369/5117552 [100%] │ 819.63 MB │
├────────────────────┼───────────────────────┼────────────────┤
│ CPU Usage │ CPU Speed │ OS Platform │
├────────────────────┼───────────────────────┼────────────────┤
│ 0.61% │ 2100 │ linux │
├────────────────────┼───────────────────────┼────────────────┤
│ OS Arch │ OS Uptime │OS Load Average │
├────────────────────┼───────────────────────┼────────────────┤
│ x64 │ 14 days │ 0s │
├────────────────────┼───────────────────────┼────────────────┤
│ Discord.js Version │ Klasa Version │ Node Version │
├────────────────────┼───────────────────────┼────────────────┤
│ 12.0.0-dev │ 0.5.0-dev │ Node v11.9.0 │
├────────────────────┼───────────────────────┼────────────────┘
│ Listeners │ Provider │
├────────────────────┼───────────────────────┤
│ 31/Infinity │ rethinkdb │
└────────────────────┴───────────────────────┘
Instead of like this
┌────────────────────┬───────────────────────┬────────────────┐
│ Guilds │ Channels │ Aprox. Users │
├────────────────────┼───────────────────────┼────────────────┤
│ 137 │ 4,838 │ 295,012 │
├────────────────────┼───────────────────────┼────────────────┤
│ Messages sent │ Messages received │ Commands used │
├────────────────────┼───────────────────────┼────────────────┤
│ 25 │ 190 │ 9,756 │
├────────────────────┼───────────────────────┼────────────────┤
│Highlights triggered│ Mentions │ Shard │
├────────────────────┼───────────────────────┼────────────────┤
│ 100,356 │ 0 │ not sharded │
├────────────────────┼───────────────────────┼────────────────┤
│ Uptime │ Uptime Percentage │ Memory Used │
├────────────────────┼───────────────────────┼────────────────┤
│ 3 minutes │5092369/5117552 [100%] │ 819.63 MB │
├────────────────────┼───────────────────────┼────────────────┤
│ CPU Usage │ CPU Speed │ OS Platform │
├────────────────────┼───────────────────────┼────────────────┤
│ 0.61% │ 2100 │ linux │
├────────────────────┼───────────────────────┼────────────────┤
│ OS Arch │ OS Uptime │OS Load Average │
├────────────────────┼───────────────────────┼────────────────┤
│ x64 │ 14 days │ 0s │
├────────────────────┼───────────────────────┼────────────────┤
│ Discord.js Version │ Klasa Version │ Node Version │
├────────────────────┼───────────────────────┼────────────────┤
│ 12.0.0-dev │ 0.5.0-dev │ Node v11.9.0 │
├────────────────────┼───────────────────────┼────────────────┤
│ Listeners │ Provider │ │
├────────────────────┼───────────────────────┤ │
│ 31/Infinity │ rethinkdb │ │
└────────────────────┴───────────────────────┴────────────────┘
Hi there,
Thanks for your continuous effort to maintain this library! We got an automatic update to version 0.6.1 today, which we get as transitive dependency of the jscpd library.
From 0.6.1 on our build starts to fail with "JavaScript heap out of memory". The whole error message goes like this:
07:50:37 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
07:50:37 1: 0xafedf0 node::Abort() [node]
07:50:37 2: 0xa1814d node::FatalError(char const*, char const*) [node]
07:50:37 3: 0xce792e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
07:50:37 4: 0xce7ca7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
07:50:37 5: 0xeb1685 [node]
07:50:37 6: 0xec081d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
07:50:37 7: 0xec399c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
07:50:37 8: 0xe85f25 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
07:50:37 9: 0xe80e29 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
07:50:37 10: 0xe80ee5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
07:50:37 11: 0x103a755 [node]
07:50:37 12: 0x1099ad5 [node]
07:50:37 13: 0x109f9a5 v8::internal::FastKeyAccumulator::GetKeys(v8::internal::GetKeysConversion) [node]
07:50:37 14: 0x11f0116 v8::internal::Runtime_ForInEnumerate(int, unsigned long*, v8::internal::Isolate*) [node]
07:50:37 15: 0x15c9eb9 [node]
07:50:37 Aborted (core dumped)
07:50:37 [06:50:34] '<anonymous>' errored after 1.1 min
07:50:37 [06:50:34] Error: Command failed: npx jscpd --config jscpd.json src
07:50:37
07:50:37 <--- Last few GCs --->
07:50:37
07:50:37 [4037119:0x6805550] 63743 ms: Scavenge 4041.5 (4114.7) -> 4040.7 (4124.7) MB, 15.1 / 0.0 ms (average mu = 0.618, current mu = 0.351) allocation failure
07:50:37 [4037119:0x6805550] 63788 ms: Scavenge 4047.4 (4124.7) -> 4045.2 (4126.0) MB, 30.3 / 0.0 ms (average mu = 0.618, current mu = 0.351) allocation failure
07:50:37 [4037119:0x6805550] 65472 ms: Scavenge 4048.4 (4126.0) -> 4046.9 (4146.0) MB, 1674.8 / 0.0 ms (average mu = 0.618, current mu = 0.351) allocation failure
07:50:37
07:50:37
07:50:37 <--- JS stacktrace --->
07:50:37
07:50:37 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
07:50:37 1: 0xafedf0 node::Abort() [node]
07:50:37 2: 0xa1814d node::FatalError(char const*, char const*) [node]
07:50:37 3: 0xce792e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
07:50:37 4: 0xce7ca7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
07:50:37 5: 0xeb1685 [node]
07:50:37 6: 0xec081d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
07:50:37 7: 0xec399c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
07:50:37 8: 0xe85f25 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
07:50:37 9: 0xe80e29 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
07:50:37 10: 0xe80ee5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
07:50:37 11: 0x103a755 [node]
07:50:37 12: 0x1099ad5 [node]
07:50:37 13: 0x109f9a5 v8::internal::FastKeyAccumulator::GetKeys(v8::internal::GetKeysConversion) [node]
07:50:37 14: 0x11f0116 v8::internal::Runtime_ForInEnumerate(int, unsigned long*, v8::internal::Isolate*) [node]
07:50:37 15: 0x15c9eb9 [node]
07:50:37 Aborted (core dumped)
07:50:37
07:50:37 at ChildProcess.exithandler (node:child_process:397:12)
07:50:37 at ChildProcess.emit (node:events:394:28)
07:50:37 at ChildProcess.emit (node:domain:537:15)
07:50:37 at maybeClose (node:internal/child_process:1067:16)
07:50:37 at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
07:50:37 at Process.callbackTrampoline (node:internal/async_hooks:130:17)
07:50:37 [06:50:34] 'lint' errored after 1.1 min
Now when you downgrade again to 0.6.0, it starts to work again. The strange thing is also that the console output seems to be totally screwed. See for yourself here:
Maybe you find some time to have a look? Thank you so much :-)
https://www.npmjs.com/package/@types/cli-table2
https://www.npmjs.com/package/@types/cli-table3 (404)
I don't have any experience creating @types packages, so unfortunately I don't have further pointers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.