Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/makepad-fr/minimist
A Dart package for parsing command line arguments and options.
https://github.com/makepad-fr/minimist
argument-parser dart dart-library dart-package dartlang
Last synced: 21 days ago
JSON representation
A Dart package for parsing command line arguments and options.
- Host: GitHub
- URL: https://github.com/makepad-fr/minimist
- Owner: Makepad-fr
- License: mit
- Archived: true
- Created: 2020-04-30T23:25:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T08:56:28.000Z (over 2 years ago)
- Last Synced: 2024-10-29T03:05:50.993Z (22 days ago)
- Topics: argument-parser, dart, dart-library, dart-package, dartlang
- Language: Dart
- Homepage: https://pub.dev/packages/minimist
- Size: 30.3 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# minimist
[![Clique-Paris](https://circleci.com/gh/Clique-Paris/minimist.svg?style=svg)](https://app.circleci.com/pipelines/github/Clique-Paris/minimist)
A Dart module for parsing command line parameters and options, inspired from the [minimist](https://www.npmjs.com/package/minimist) npm module.
## Usage
A simple usage example:
```dart
import 'package:minimist/minimist.dart';main(List arguments) {
var args = Minimist(arguments).args;
print(args);
}
``````shell
$ dart example/minimist.dart -f foo -b bar
{_: [], f: foo, b: bar}$ dart example/minimist.dart -x 0 -y 1 -n2 -abc --hello=world foo bar baz -def42
{_: [foo, bar, baz], x: 0, y: 1, n: 2, a: true, b: true, c: true, hello: world, d: true, e: true, f: 42}
```A more complex usage by using parsing options (aka `MinimistOptions`):
```dart
import 'package:minimist/minimist.dart';main (List arguments) {
var args = Minimist(arguments,
options: MinimistOptions(
string: ['lang', 'username', 'password'],
boolean: ['pager'],
alias: {
'h': 'help',
'v': 'version',
'u': 'username',
'password': 'p',
'g': 'pager'
},
byDefault: {'lang': 'en'},
)).args;
print(args);
}
``````shell
$ dart example/minimist_with_options.dart --lang xml --pager -u=root -h hello -- index.js package.json{_: [index.js, package.json, hello], lang: xml, username: root, u: root, pager: true, g: true, h: true, help: true, v: false, version: false}
``````shell
$ dart example/minimist_with_options.dart -- index.js package.json{_: [index.js, package.json], pager: false, g: false, h: false, help: false, v: false, version: false, lang: en}
```## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
[tracker]: https://github.com/Clique-Paris/minimist/issues