14 lines
360 B
TypeScript
14 lines
360 B
TypeScript
import { $ } from "bun";
|
|
|
|
export const l$ = (strings: TemplateStringsArray, ...values: any[]) => {
|
|
// Interleave the static strings with the evaluated values
|
|
const cmd = strings.reduce((acc, str, i) => {
|
|
const val = values[i - 1];
|
|
return acc + (i > 0 ? $.escape(val) : "") + str;
|
|
});
|
|
|
|
console.log(`> ${cmd.trim()}`);
|
|
|
|
return $(strings, ...values);
|
|
};
|