completion 0.2.1+1

  • Readme
  • Changelog
  • Installing
  • 87

Add shell command completion to your Dart console applications.

Build Status Coverage Status

To use this package, instead of this:

import 'packages:args/args.dart';

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

do this:

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

void main(List<String> args) {
  ArgParser argParser = new ArgParser();
  argParser.addFlag('option', help: 'flag help');
  // ... add more options ...
  ArgResults 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.

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.

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate completion

2. Use it

The package has the following executables:


$ shell_completion_generator

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  completion: ^0.2.1+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:completion/completion.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
94
Health:
Code health derived from static analysis. [more]
92
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
63
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Health suggestions

Fix lib/src/generate.dart. (-2.48 points)

Analysis of lib/src/generate.dart reported 5 hints:

line 15 col 23: Unnecessary new keyword.

line 29 col 11: Unnecessary new keyword.

line 36 col 13: Unnecessary new keyword.

line 40 col 16: Unnecessary new keyword.

line 54 col 18: Unnecessary new keyword.

Fix lib/src/bot.dart. (-1.49 points)

Analysis of lib/src/bot.dart reported 3 hints:

line 40 col 11: Unnecessary new keyword.

line 47 col 11: Unnecessary new keyword.

line 53 col 11: Unnecessary new keyword.

Fix lib/src/get_args_completions.dart. (-1.49 points)

Analysis of lib/src/get_args_completions.dart reported 3 hints:

line 69 col 33: Unnecessary new keyword.

line 288 col 10: Unnecessary new keyword.

line 292 col 17: Unnecessary new keyword.

Fix additional 3 files with analysis or formatting issues. (-2.50 points)

Additional issues in the following files:

  • lib/src/try_completion.dart (2 hints)
  • lib/src/util.dart (2 hints)
  • lib/completion.dart (1 hint)

Maintenance suggestions

Package is getting outdated. (-36.99 points)

The package was last published 71 weeks ago.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and completion.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.54.0 <3.0.0
args ^1.4.0 1.5.2
logging ^0.11.0 0.11.3+2
path ^1.0.0 1.6.4
Dev dependencies
test ^1.2.0
test_process ^1.0.1