GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - VeryGoodOpenSource/cli_completion: Completion functionality for Dart Command-Line Interfaces built using CommandRunner. Built by Very Good Ventures. 🦄

BranchesTags
Open more actions menu

Latest commit

 

History

96 Commits
96 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.idea
.idea
 
 
doc
doc
 
 
example
example
 
 
lib
lib
 
 
test/src
test/src
 
 
tool
tool
 
 
.gitignore
.gitignore
 
 
.release-please-config.json
.release-please-config.json
 
 
.release-please-manifest.json
.release-please-manifest.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
analysis_options.yaml
analysis_options.yaml
 
 
coverage_badge.svg
coverage_badge.svg
 
 
pubspec.yaml
pubspec.yaml
 
 

Repository files navigation

CLI Completion

Very Good Ventures Very Good Ventures

ci coverage pub package style: very good analysis License: MIT


screen

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

Usage ✨

On your CommandRunner class, extend CompletionCommandRunner :

import 'package:cli_completion/cli_completion.dart';

class ExampleCommandRunner extends CompletionCommandRunner<int> {
...

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;
...

When enableAutoInstall is set to false, users will have to call install-completion-files to install these files manually.

$ example_cli install-completion-files

Additionally, when enableAutoInstall is disabled a completion-script command is exposed. It prints the completion script for the current shell to stdout, so users can install it wherever they prefer:

$ example_cli completion-script >> ~/.zshrc

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 

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

About

Completion functionality for Dart Command-Line Interfaces built using CommandRunner. Built by Very Good Ventures. 🦄

pub.dev/packages/cli_completion

Topics

clicommand-linecompletiondart

Resources

Readme
MIT license
Activity
Custom properties

Stars

54 stars

Watchers

3 watching

Forks

6 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.