sshMultiCommand method

List<String> sshMultiCommand({
  1. required bool ipv6,
  2. required String sshTarget,
  3. required List<String> commands,
  4. bool addHostToKnownHosts = false,
  5. String endCharacter = ';',
})

Implementation

List<String> sshMultiCommand({
  required bool ipv6,
  required String sshTarget,
  required List<String> commands,
  bool addHostToKnownHosts = false,
  String endCharacter = ';',
}) =>
    [
      'ssh',
      '-o',
      'BatchMode=yes',
      if (addHostToKnownHosts) ...[
        '-o',
        'StrictHostKeyChecking=accept-new',
      ],
      if (ipv6) '-6',
      sshTarget,
      ...commands.map(
          (e) => e.trim().endsWith(' $endCharacter') ? e : '$e$endCharacter'),
    ];