Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/modules/commander.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the doc file, as it's currently commander

description: Modern alternatives to packages for building CLI applications
---

# Replacements for CLI builders

## `sade`

[`sade`](https://github.com/lukeed/sade) is a small but powerful tool for building CLI applications for Node.js

```ts
import sade from 'sade'

const prog = sade('my-cli')

prog
.version('1.0.5')
.option('--global, -g', 'An example global flag')
.option('-c, --config', 'Provide path to custom config', 'foo.config.js')

prog
.command('build <src> <dest>')
.describe('Build the source directory. Expects an `index.js` entry file.')
.option('-o, --output', 'Change the name of the output file', 'bundle.js')
.example('build src build --global --config my-conf.js')
.example('build app public -o main.js')
.action((src, dest, opts) => {
console.log(`> building from ${src} to ${dest}`)
console.log('> these are extra opts', opts)
})

prog.parse(process.argv)
```
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a link to the parseargs doc.

#528 (comment)

Also we could add a link back to this one for the other doc too?

12 changes: 12 additions & 0 deletions manifests/preferred.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@
"replacements": ["util.styleText", "picocolors", "ansis"],
"url": {"type": "e18e", "id": "chalk"}
},
"commander": {
"type": "module",
"moduleName": "commander",
"replacements": ["sade"],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also add cleye i think (as a replacement for meow etc)

#528 (comment)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we adding more from this list here? cc: @43081j

#274 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think adding cleye and possibly stricli would make sense

"url": {"type": "e18e", "id": "commander"}
},
"copy-text-to-clipboard": {
"type": "module",
"moduleName": "copy-text-to-clipboard",
Expand Down Expand Up @@ -3371,6 +3377,12 @@
"type": "documented",
"replacementModule": "rollup-plugin-visualizer"
},
"sade": {
"id": "sade",
"type": "documented",
"url": {"type": "e18e", "id": "commander"},
"replacementModule": "sade"
},
"smol-toml": {
"id": "smol-toml",
"type": "documented",
Expand Down