Skip to content

showHelp() throws TypeError #25

Open
@russelldavis

Description

@russelldavis

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/[email protected]/node_modules/cleye/dist/index.mjs:9:13)
    at file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/[email protected]/node_modules/cleye/dist/index.mjs:8:90
    at Array.map (<anonymous>)
    at file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/[email protected]/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/[email protected]/node_modules/cleye/dist/index.mjs:8:69)
    at M.render (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/[email protected]/node_modules/cleye/dist/index.mjs:9:87)
    at M.section (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/[email protected]/node_modules/cleye/dist/index.mjs:7:37)
    at M.render (file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/[email protected]/node_modules/cleye/dist/index.mjs:9:87)
    at file:///Users/russell/dev/js/trigger-jobs/node_modules/.pnpm/[email protected]/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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions