版博士V2.0程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

12345678910111213141516171819
  1. import {debuglog} from 'node:util';
  2. import process from 'node:process';
  3. export const verboseDefault = debuglog('execa').enabled;
  4. const padField = (field, padding) => String(field).padStart(padding, '0');
  5. const getTimestamp = () => {
  6. const date = new Date();
  7. return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
  8. };
  9. export const logCommand = (escapedCommand, {verbose}) => {
  10. if (!verbose) {
  11. return;
  12. }
  13. process.stderr.write(`[${getTimestamp()}] ${escapedCommand}\n`);
  14. };