assertShellInert function

void assertShellInert(
  1. String value,
  2. String describe
)

Throws a FormatException if value carries a shell-active character.

describe names the source for the error, e.g. positional argument $1.

Implementation

void assertShellInert(String value, String describe) {
  if (_shellUnsafePattern.hasMatch(value)) {
    throw FormatException(
      'Refusing to run: $describe contains a character the shell could '
      'interpret. merry substitutes it as text and cannot keep it inert inside '
      'quotes. Allowed: letters, digits, spaces and _@%+=:,./- .',
    );
  }
}