CompletionInstallation.fromSystemShell constructor

CompletionInstallation.fromSystemShell({
  1. required SystemShell? systemShell,
  2. required Logger logger,
  3. bool? isWindowsOverride,
  4. Map<String, String>? environmentOverride,
})

Creates a CompletionInstallation given the current systemShell.

If systemShell is null, it will assume that the current shell is unknown and configuration will be null.

Pass isWindowsOverride to override the default value of Platform.isWindows.

Pass environmentOverride to override the default value of Platform.environment.

Implementation

factory CompletionInstallation.fromSystemShell({
  required SystemShell? systemShell,
  required Logger logger,
  bool? isWindowsOverride,
  Map<String, String>? environmentOverride,
}) {
  final isWindows = isWindowsOverride ?? Platform.isWindows;
  final environment = environmentOverride ?? Platform.environment;

  final configuration = systemShell == null
      ? null
      : ShellCompletionConfiguration.fromSystemShell(systemShell);

  return CompletionInstallation(
    configuration: configuration,
    logger: logger,
    isWindows: isWindows,
    environment: environment,
  );
}