Skip to content
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

RangeError on ux.table when column starts with emoji #941

Closed
aaronmgdr opened this issue Feb 8, 2024 · 1 comment
Closed

RangeError on ux.table when column starts with emoji #941

aaronmgdr opened this issue Feb 8, 2024 · 1 comment

Comments

@aaronmgdr
Copy link

Describe the bug

When the dataset includes a column with value with "🔱" e.g. "🔱MasterNode" AND there are sufficiently long strings in columns

RangeError: Invalid count value
    at String.repeat (<anonymous>)
    at Table.outputTable (node_modules/@oclif/core/lib/cli-ux/styled/table.js:284:37)
    at Table.display (node_modules/@oclif/core/lib/cli-ux/styled/table.js:137:22)
    at Object.table (node_modules/@oclif/core/lib/cli-ux/styled/table.js:301:39)

To Reproduce
Steps to reproduce the behavior:

import { Command, ux } from '@oclif/core'

export const exampleColumns: ux.Table.table.Columns<{ name: string; otherLongName: string }> = {
  name: { get: (row) => row.name },
  otherLongName: { get: (row) => row.otherLongName },
}

const data = [
  {
    name: 'Zeus',
    otherLongName:
      'antidisestablishmentarianismantidisestablishmentarianismantidisestablishmentarianismantidisestablishmentarianism',
  },
  {
    name: 'Hades',
    otherLongName: 'antidisestablishmentarianism',
  },
  {
    name: '🔱 Poseidon 0xDf472FB9a7d4e43F0d46905E0A39De549fB9C4F5',
    otherLongName: 'antidisestablishmentarianism',
  },
]

export default class Demo extends Command {
  async run() {
    ux.table(data, exampleColumns)
  }
}

Expected behavior

Emoji charaters should not cause table to stop rendering. should be able to see the full table. Note this did not happen in old oclif (pre 1.0)

Environment (please complete the following information):

  • OS & version: MacOS Ventura 13.6.1
  • Shell/terminal & version : iterm

Additional context
Add any other context about the problem here.

@aaronmgdr
Copy link
Author

upgrading to from 3.18.1 to 3.19.1 seems to have fixed the issue

aaronmgdr added a commit to celo-org/developer-tooling that referenced this issue Feb 8, 2024
…ors:list command to due 🔱Masternode24 validator
aaronmgdr added a commit to celo-org/developer-tooling that referenced this issue Feb 12, 2024
* upgrade oclif core to fix bug oclif/core#941 which occured on validators:list command to due 🔱Masternode24 validator

* need to explictly write out the getters for the ux table or the info will be blank,
get all contracts at same time
no need to fetch block number on two lines back to back

---------

Co-authored-by: Aaron <aaron.deruvo@clabs.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant