installTabCompletion method

  1. @override
void installTabCompletion({
  1. bool quiet = false,
})
override

If the shell supports tab completion then install it. If quiet is true then suppress any console output except for errors.

Implementation

@override
void installTabCompletion({bool quiet = false}) {
  if (!isCompletionInstalled) {
    // Add cli completion
    /// -o nospace - after directory names

    const command = "complete -o nospace -C 'dcli_complete' dcli";

    final startFile = pathToStartScript;

    if (!exists(startFile)) {
      touch(startFile, create: true);
    }
    startFile.append(command);

    if (!quiet) {
      print(
        'dcli tab completion installed. '
        'Restart your terminal to activate it.',
      );
    }
  }
}