completion 1.0.0 icon indicating copy to clipboard operation
completion: ^1.0.0 copied to clipboard

A package to add shell command completion to your Dart application

Add shell command completion to your Dart console applications.

Build Status

To use this package, instead of this:

import 'package:args/args.dart';

void main(List<String> args) {
  final argParser = ArgParser()..addFlag('option', help: 'flag help');
  // ... add more options ...
  final argResults = argParser.parse(args);
  // ...
}

do this:

import 'package:args/args.dart';
import 'package:completion/completion.dart' as completion;

void main(List<String> 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.

19
likes
120
pub points
99%
popularity

Publisher

verified publisher iconj832.com

A package to add shell command completion to your Dart application

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.BSD-2-Clause-Views (LICENSE)

Dependencies

args, logging, path

More

Packages that depend on completion