command-line-usage: Deno runtime not supported

Due to https://github.com/denoland/deno/issues/13321, the library fails with

error: Uncaught TypeError: chalk.underline.bold is not a function
    at ContentSection.header (file:///Users/ulken/Library/Caches/deno/npm/registry.npmjs.org/command-line-usage/6.1.3/lib/section.js:23:32)

The version of chalk used is really old. Please consider upgrading to at least 4.X, where the issue above is fixed. If you want to take the step to ESM, you might want to take it to 5.X+ even.

If you’re up for it, let me know if you want me to help out in any way.

PS. Even if you have no intention of supporting Deno, I think it would still be worth to upgrade Chalk to a more modern (and safer) version.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Hey, look at that!

Screenshot 2023-02-14 at 16 50 53

For unknown reason, the formatting is not displayed in Warp, but that is on them (works in Hyper and Terminal.app)…

https://app.warp.dev/block/nvpi0MT2iXS45OmFaVQyjT

Is it erroneously thinking it’s piped and strips the formatting? Idk. Don’t bother.

  1. Install Deno
  2. mkdir cli-usage-deno && cd $_
  3. deno init
  4. Replace contents of main.ts with
import cliUsage from "npm:command-line-usage";

if (import.meta.main) {
  console.log(cliUsage([
    { 
      header: "Deno CLI usage", 
      content: "Best thing ever"
    }
  ]));
}
  1. deno run --allow-read --allow-env main.ts (could also pass --allow-all if you prefer)

Let me know if you get stuck on something.