https://github.com/3rd-eden/timbers
Shiver me timbers! A tool to map short CLI argument to long CLI arguments
https://github.com/3rd-eden/timbers
args argument-parser arguments cli
Last synced: 7 months ago
JSON representation
Shiver me timbers! A tool to map short CLI argument to long CLI arguments
- Host: GitHub
- URL: https://github.com/3rd-eden/timbers
- Owner: 3rd-Eden
- License: mit
- Created: 2019-06-06T18:10:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-06T18:11:21.000Z (almost 7 years ago)
- Last Synced: 2025-09-02T03:59:59.813Z (8 months ago)
- Topics: args, argument-parser, arguments, cli
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# timbers
Argh! Shiver me timbers. The `timbers` library is a natural extension to `argh`.
It allows you to easily transform short hand CLI flags into their long hand
counter parts.
## Installation
The package is published to npm and can be installed by running:
```
npm install --save timbers
```
## Usage
```js
const timbers = require('timbers');
const argh = require('argh');
const defaults = {
cwd: process.cwd().
foo: 'bar'
};
const args = timbers([
'-c, --cwd'
], { ...defaults, ...argh.argv });
console.log(args);
//
// { cwd: process.cwd(), foo: 'bar' } // No values passed
// { cwd: 'bar', foo: 'bar' } // -c bar
// { cwd: 'bar', foo: 'bar' } // --cwd bar
//
```
While the library was designed with [argh] in mind, it will work with any
object. It accepts the following arguments:
- `flags`, **Array**, An array of strings that contain the mapping of short to
long flags. For example: `-r, --require`. You can also map multiple short
flags to a long flag: `-r, -e, --require`.
- `arg`, **Object**, Object with values that should be used as data source.
## License
[MIT](LICENSE)
[argh]: https://github.com/3rd-Eden/argh#readme