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

showHelp() throws TypeError #25

Open
1 task
russelldavis opened this issue Nov 2, 2023 · 0 comments
Open
1 task

showHelp() throws TypeError #25

russelldavis opened this issue Nov 2, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@russelldavis
Copy link

Bug description

Run the code below (it seems to only happen when there's a command that has a custom help option). It results in this error:

TypeError: Cannot use 'in' operator to search for 'type' in undefined
    at M.render (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:9:13)
    at file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:8:90
    at Array.map (<anonymous>)
    at file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:8:78
    at Array.map (<anonymous>)
    at M.table (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:8:69)
    at M.render (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:9:87)
    at M.section (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:7:37)
    at M.render (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:9:87)
    at file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/cleye@1.3.2/node_modules/cleye/dist/index.mjs:8:904

Reproduction

import { cli, command } from 'cleye'

const argv = cli({
  name: 'foo',
  commands: [
    command({
      name: "bar",
      help: {
        usage: "baz"
      }
    })
  ],
})

argv.showHelp()

Node.js package manager

pnpm

Environment

System:
    OS: macOS 13.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 2.11 GB / 32.00 GB
    Shell: 5.2.15 - /opt/homebrew/bin/bash
  Binaries:
    Node: 18.18.2 - ~/.local/share/rtx/installs/node/18.18.2/bin/node
    Yarn: 1.22.19 - ~/.local/share/rtx/installs/node/18.18.2/bin/yarn
    npm: 9.8.1 - ~/.local/share/rtx/installs/node/18.18.2/bin/npm
    pnpm: 8.9.2 - ~/.local/share/rtx/installs/node/18.18.2/bin/pnpm

Can you contribute a fix?

  • I’m interested in opening a pull request for this issue.
@russelldavis russelldavis added the bug Something isn't working label Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant