Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevmoo/completion.dart
A packaged to add shell command completion to your application
https://github.com/kevmoo/completion.dart
Last synced: 12 days ago
JSON representation
A packaged to add shell command completion to your application
- Host: GitHub
- URL: https://github.com/kevmoo/completion.dart
- Owner: kevmoo
- License: bsd-3-clause
- Created: 2014-02-15T22:39:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-10-01T18:05:56.000Z (about 1 month ago)
- Last Synced: 2024-10-19T01:32:13.193Z (22 days ago)
- Language: Dart
- Homepage: https://pub.dev/packages/completion
- Size: 12.4 MB
- Stars: 60
- Watchers: 4
- Forks: 11
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
*Add shell command completion to your Dart console applications.*
[![Build Status](https://github.com/kevmoo/completion.dart/workflows/ci/badge.svg?branch=master)](https://github.com/kevmoo/completion.dart/actions?query=workflow%3A"ci"+branch%3Amaster)
[![pub package](https://img.shields.io/pub/v/completion.svg)](https://pub.dev/packages/completion)
[![package publisher](https://img.shields.io/pub/publisher/completion.svg)](https://pub.dev/packages/completion/publisher)To use this package, instead of this:
```dart
import 'package:args/args.dart';void main(List args) {
final argParser = ArgParser()..addFlag('option', help: 'flag help');
// ... add more options ...
final argResults = argParser.parse(args);
// ...
}
```do this:
```dart
import 'package:args/args.dart';
import 'package:completion/completion.dart' as completion;void main(List args) {
final argParser = ArgParser()..addFlag('option', help: 'flag help');
// ... add more options ...
final argResults = completion.tryArgsCompletion(args, argParser);
// ...
}
```(The only difference is calling `complete.tryArgsCompletion` in place of `argParser.parse`)
This will add a "completion" command to your app, which the shell will use
to complete arguments.To generate the setup script automatically, call `generateCompletionScript`
with the names of the executables that your Dart script runs as (typically
just one, but it could be more).Also, see [the example](./example).