cli_completion

Creator: coderz1093

Last updated:

0 purchases

cli_completion Image
cli_completion Images

Languages

Categories

Add to Cart

Description:

cli completion

CLI Completion #









Completion functionality for Dart Command-Line Interfaces built using CommandRunner.
Developed with 💙 by Very Good Ventures 🦄
Installation 💻 #
❗ In order to start using CLI Completion you must have the Dart SDK installed
on your machine.
flutter pub add cli_completion
copied to clipboard
Usage ✨ #
On your CommandRunner class, extend CompletionCommandRunner :
import 'package:cli_completion/cli_completion.dart';

class ExampleCommandRunner extends CompletionCommandRunner<int> {
...
copied to clipboard
This will make the first command run to install the completion files automatically. To disable that behavior, set enableAutoInstall to false:
class ExampleCommandRunner extends CompletionCommandRunner<int> {

@override
bool get enableAutoInstall => false;
...
copied to clipboard
When enableAutoInstall is set to false, users will have to call install-completion-files to install these files manually.
$ example_cli install-completion-files
copied to clipboard
Documentation 📝 #
For an overview of how this package works, check out the documentation.

Troubleshooting 🧠🔨 #
Tab completion is taking too long #
Handling completion requests should be straightforward.
If there are any checks (like analytics, telemetry, or anything that you may have on run or runCommand overrides) before running subcommands, make sure you fast track the completion command to skip all of the unnecessary computations.
Example:
@override
Future<int?> runCommand(ArgResults topLevelResults) async {
if (topLevelResults.command?.name == 'completion') {
super.runCommand(topLevelResults);
return;
}
// ... analytics and other unrelated stuff
copied to clipboard
Tab completion is not working on my zsh terminal #
If you are not using any zsh framework such as Oh My Zsh, you have to start the completion system manually.
Add the following lines to your ~/.zshrc file:
# Add this to the start of your zsh starter file (~/.zshrc)
autoload -Uz compinit
compinit
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.