Skip to content

ShellCompleter

Category: Shell

Source: shell_completer.dart

Enums

ShellType

The type of shell detected on the system.

ValueDescription
bash
fish
zsh
sh

Classes

ShellCandidate

A single completion candidate from the shell.

Constructor

dart
ShellCandidate(this.text, {this.description, this.isDirectory = false})

Properties

PropertyTypeDescription
textString
descriptionString?
isDirectorybool

ShellCompleter

Spawns shell subprocesses to produce tab-completion candidates.

Uses compgen for bash/zsh/sh and complete -C for fish. Results are cached with a short TTL to avoid repeated subprocess spawns.

Constructor

dart
ShellCompleter({ShellType? shellType})

Properties

PropertyTypeDescription
shellTypeShellType

Methods

int tokenStart(String buffer)

Extract the start position of the completable token.

Given "git checkout --fo", returns the index of "--fo" (15). Given "ls", returns 0. Given "cat ", returns 4 (empty token at end).

Future<List<ShellCandidate>> complete(String buffer)

Get completions for the given command line buffer.

Released under the MIT License.