completion
1.0.2A package to add shell command completion to your Dart application
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
tryCompletionfrom 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
tryCompletionmethod as a public interface. -
Added more complete instructions in the
README.md
0.2.0
-
Renamed
COMPLETION_COMMAND_NAMEtocompletionCommandName. -
Added named
logFileargument totryArgsCompletionandtryCompletionto 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
argsversion.
0.1.2+4
- Allow latest
argsversion.
0.1.2+3
- Code cleanup.
0.1.2+2
-
Stopped using deprecated features from
botpackage. -
Formatting
0.1.2+1
- Updated
hopand addedhop_unittestdev 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
completionlibrary from thebot_iopackage as of release0.25.1+2.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add completionpubspec.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
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0-dev | On demand | Download | d5a13ae5…25a966 |
| 0.1.0-dev+1 | On demand | Download | 5af484c7…6ff60c |
| 0.1.0 | On demand | Download | 00d93f3b…a26924 |
| 0.1.1 | On demand | Download | ccda3048…7ec7f5 |
| 0.1.2 | On demand | Download | 6e904b7a…970999 |
| 0.1.2+1 | On demand | Download | 20b4701a…15b241 |
| 0.1.2+2 | On demand | Download | 22fd69d2…8eb362 |
| 0.1.2+3 | On demand | Download | 497a8f28…523c7b |
| 0.1.2+4 | On demand | Download | 743ce6c4…fd5955 |
| 0.1.2+5 | On demand | Download | 7da34e16…c22226 |
| 0.1.2+6 | On demand | Download | 6caaa6ad…bf11e5 |
| 0.1.3 | On demand | Download | c839c730…26b79d |
| 0.1.4 | On demand | Download | c1dce79e…4a0942 |
| 0.1.5 | On demand | Download | f4fa6b8a…5ae1d2 |
| 0.1.6 | On demand | Download | 3a8f29c7…56cf9d |
| 0.2.0 | On demand | Download | 93312938…229444 |
| 0.2.1 | On demand | Download | 894f29b1…53be8c |
| 0.2.1+1 | On demand | Download | 0b0917f4…9f5625 |
| 0.2.2 | On demand | Download | 94537419…155c13 |
| 0.2.3 | On demand | Download | 2a5f2a24…6ec295 |
| 1.0.0 | On demand | Download | 476da0f8…7dccd5 |
| 1.0.1 | On demand | Download | f11b7a62…d11c60 |
| 1.0.2 | Cached · Upstream SHA-256 matched | Download | 82fa0980…1d0f5b |
Dependencies
args "^2.0.0"
logging "^1.0.0"
path "^1.8.0"