compressCommand method

List<String> compressCommand({
  1. String compressedFileName = 'archive.tar.gz',
  2. String source = '.',
  3. bool lastCommand = false,
  4. List<String> exclude = const [],
})

This command is used to compress a folder

since we can use tar command in powershell in windows 10 and above we can use the same command for windows, linux and macos

Implementation

List<String> compressCommand({
  String compressedFileName = 'archive.tar.gz',
  String source = '.',
  bool lastCommand = false,
  List<String> exclude = const [],
}) =>
    [
      'tar',
      '-czvf',
      compressedFileName,
      if (exclude.isNotEmpty) ...exclude.map((e) => '--exclude=\'$e\''),
      source,
      lastCommand ? '' : ';',
    ];