completion

1.0.2

A package to add shell command completion to your Dart application

Download archive

Readme

Add shell command completion to your Dart console applications.

Dart CI pub package package publisher

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.

Changelog

1.0.2

  • Fix README link
  • Require Dart 3.7.0

1.0.1

  • Require Dart 2.18.0
  • Update license.

1.0.0

  • Support null safety.

0.2.3

  • Prevent tryCompletion from crashing when looking up the script name when run without a current working directory.

0.2.2

  • Increase minimum Dart SDK to 2.3.0.

0.2.1+1

  • Small fix to error handler.

0.2.1

  • Exposed the tryCompletion method as a public interface.

  • Added more complete instructions in the README.md

0.2.0

  • Renamed COMPLETION_COMMAND_NAME to completionCommandName.

  • Added named logFile argument to tryArgsCompletion and tryCompletion to aid debugging.

0.1.6

  • A bunch of internal cleanup.

0.1.5

  • Support the latest version of logging.

0.1.4

  • Don't blow up if run via pub run.

0.1.2+5

  • Fix for latest args version.

0.1.2+4

  • Allow latest args version.

0.1.2+3

  • Code cleanup.

0.1.2+2

  • Stopped using deprecated features from bot package.

  • Formatting

0.1.2+1

  • Updated hop and added hop_unittest dev dependencies.

0.1.2

  • Fixed test runner.

0.1.1 2014-03-04

  • Removed unneeded dependency on bot_io
  • Cleanup of other references to bot_io

0.1.0 2014-02-15 (SDK 1.2.0-dev.5.7 32688)

  • First release
  • Maintains 100% compatibility with the completion library from the bot_io package as of release 0.25.1+2.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add completion
pubspec.yaml
name: completion
version: 1.0.2
description: A package to add shell command completion to your Dart application
repository: https://github.com/kevmoo/completion.dart

environment:
  sdk: ^3.7.0

dependencies:
  args: ^2.0.0
  logging: ^1.0.0
  path: ^1.8.0

dev_dependencies:
  dart_flutter_team_lints: ^3.0.0
  test: ^1.16.6
  test_process: ^2.0.0

executables:
  shell_completion_generator: null

Version history

VersionPublishedArchiveSHA-256
0.1.0-devOn demandDownloadd5a13ae5…25a966
0.1.0-dev+1On demandDownload5af484c7…6ff60c
0.1.0On demandDownload00d93f3b…a26924
0.1.1On demandDownloadccda3048…7ec7f5
0.1.2On demandDownload6e904b7a…970999
0.1.2+1On demandDownload20b4701a…15b241
0.1.2+2On demandDownload22fd69d2…8eb362
0.1.2+3On demandDownload497a8f28…523c7b
0.1.2+4On demandDownload743ce6c4…fd5955
0.1.2+5On demandDownload7da34e16…c22226
0.1.2+6On demandDownload6caaa6ad…bf11e5
0.1.3On demandDownloadc839c730…26b79d
0.1.4On demandDownloadc1dce79e…4a0942
0.1.5On demandDownloadf4fa6b8a…5ae1d2
0.1.6On demandDownload3a8f29c7…56cf9d
0.2.0On demandDownload93312938…229444
0.2.1On demandDownload894f29b1…53be8c
0.2.1+1On demandDownload0b0917f4…9f5625
0.2.2On demandDownload94537419…155c13
0.2.3On demandDownload2a5f2a24…6ec295
1.0.0On demandDownload476da0f8…7dccd5
1.0.1On demandDownloadf11b7a62…d11c60
1.0.2Cached · Upstream SHA-256 matchedDownload82fa0980…1d0f5b

Dependencies

args "^2.0.0"

logging "^1.0.0"

path "^1.8.0"