sh.ts

small nodejs sh wrapper

import { ExecSyncOptions, execSync } from 'child_process';

export function sh(command: TemplateStringsArray, ...substitutions: any[]) {
  const fullCommand = command.reduce((acc, part, i) => acc + part + (substitutions[i] || ''), '');
  return (options?: ExecSyncOptions) => execSync(fullCommand, { encoding: 'utf-8', ...(options || {}) });
}