include method

ShellCommandsMap include({
  1. required String command,
  2. required SystemShell systemShell,
})

Returns a new ShellCommandsMap with the given command added to systemShell.

Implementation

ShellCommandsMap include({
  required String command,
  required SystemShell systemShell,
}) {
  final modifiable = _modifiable();

  if (modifiable.containsKey(systemShell)) {
    modifiable[systemShell]!.add(command);
  } else {
    modifiable[systemShell] = {command};
  }

  return UnmodifiableMapView(
    modifiable.map((key, value) => MapEntry(key, UnmodifiableSetView(value))),
  );
}