logging commands
This commit is contained in:
13
src/utils.ts
Normal file
13
src/utils.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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);
|
||||
};
|
||||
Reference in New Issue
Block a user