Comments (4)
It's a cool idea. Not sure if it's a good fit here, though, as I'm trying to stay as unopinionated as possible. Gonna keep this open for a while to see if there's any interest in this.
In the meantime I made aliases
(which uses parse-help
), so you can easily plug it into meow
.
const meow = require('meow');
const aliases = require('aliases');
const help = `
Usage
$ unicorn <name>
Options
-r, --rainbow Lorem ipsum dolor sit amet
-m, --magic Aenean commodo ligula eget dolor
`;
meow(help, {
alias: aliases(help, {h: 'help'})
})
You could potentially also make a more opinionated meow
wrapper with this.
from meow.
I like the idea, but rather don't want to see it implemented in meow
directly. The solution of @sindresorhus is quite nice!
In my opinion, the implementation of the cli app is decoupled from the documentation of the app. Today, I choose for the -r, --rainbow
notation. But maybe tomorrow I like --rainbow (-r)
better. So if I change the documentation, my cli app breaks because I haven't thought about adding the alias
property because my documentation format is not supported.
With the solution of @sindresorhus I can write my own parser for --rainbow (-r)
. And if I want -r, --rainbow
back, I can use the aliases
module.
from meow.
@adjohnson916 I see what you're saying but I don't think the cli should impose aliases based on what our help text looks like.
from meow.
Thanks @sindresorhus for creating aliases
based on my idea. Modular magic is to me an acceptable alternative to meow
magic. Perhaps at some point we could include it in meow
as an opt-in feature. If not, we should at least link to it from the README here.
from meow.
Related Issues (20)
- Use Node.js builtin HOT 4
- What is the test coverage? HOT 5
- `allowUnknownFlags: false` prevents aliases for `help` and `version`. HOT 3
- Remove `trim-newlines` dependency HOT 4
- ExperimentalWarning when using Meow with modules HOT 4
- Is it possible to make input required? HOT 3
- Improve importMeta message -`meow - The 'importMeta' option is required. Its value must be 'import.meta' at meow` HOT 7
- Expose package.json version as property HOT 4
- Allow single line help messages HOT 11
- Refactor HOT 6
- Question: huge bundle size? HOT 2
- Choices? HOT 2
- flag.default values validation is faulty
- Feature Proposal - Disable Indent HOT 12
- `meow(...).flags` is `any` in 12.1.0 HOT 1
- Add "types" field in package.json HOT 2
- typescript definitions stopped working HOT 2
- String value converted to Num HOT 2
- Remove hard-rejection
- ESLint `import/no-unresolved` false positive when module is imported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meow.