All files / src/cli/output verbosity.ts

100% Statements 13/13
100% Branches 10/10
100% Functions 2/2
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33      21x   21x   21x   21x   21x                   47x 5x   42x 4x   38x 1x   37x    
/**
 * Verbosity levels for CLI output.
 */
export enum Verbosity {
  /** Errors + final summary only */
  Quiet = 0,
  /** Normal output with progress */
  Normal = 1,
  /** Real-time findings, hunk details */
  Verbose = 2,
  /** Token counts, latencies, debug info */
  Debug = 3,
}
 
/**
 * Parse verbosity from CLI flags.
 * @param quiet - If true, return Quiet
 * @param verboseCount - Number of -v flags (0, 1, or 2+)
 * @param debug - If true, return Debug (overrides verbose count)
 */
export function parseVerbosity(quiet: boolean, verboseCount: number, debug?: boolean): Verbosity {
  if (quiet) {
    return Verbosity.Quiet;
  }
  if (debug || verboseCount >= 2) {
    return Verbosity.Debug;
  }
  if (verboseCount === 1) {
    return Verbosity.Verbose;
  }
  return Verbosity.Normal;
}