Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place
88
fork

Configure Feed

Select the types of activity you want to include in your feed.

add --quiet flag and WISPCTL_NO_PROGRESS env var #5

open opened by niri.pet targeting main from niri.pet/wisp.place-monorepo: quiet-mode

suppress spinner output with env var or flag

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:sxywkdxliruthtz3j4nqqpd2/sh.tangled.repo.pull/3mk2pr5kauu22
+32
Diff #0
+8
cli/index.ts
··· 143 143 } 144 144 145 145 program.name('wisp-cli').description('CLI for wisp.place - deploy static sites to the AT Protocol').version('1.1.1') 146 + .option('-q, --quiet', 'Suppress progress output (also set via WISPCTL_NO_PROGRESS=1)') 146 147 147 148 // Deploy command (default) 148 149 program ··· 557 558 } 558 559 }) 559 560 561 + // Set WISPCTL_NO_PROGRESS from --quiet flag before any command runs 562 + program.hook('preAction', () => { 563 + if (program.opts().quiet) { 564 + process.env.WISPCTL_NO_PROGRESS = '1' 565 + } 566 + }) 567 + 560 568 program.parse()
+24
cli/lib/progress.ts
··· 20 20 } 21 21 22 22 export function createSpinner(text: string): SpinnerLike { 23 + // when no tty is attached or WISPCTL_NO_PROGRESS is set, return a silent spinner 24 + if (!process.stdout.isTTY || process.env.WISPCTL_NO_PROGRESS === '1') { 25 + let currentText = text 26 + return { 27 + get text() { 28 + return currentText 29 + }, 30 + set text(newText: string) { 31 + currentText = newText 32 + }, 33 + start() { 34 + return this 35 + }, 36 + succeed(message?: string) { 37 + console.log(`✓ ${message ?? currentText}`) 38 + return this 39 + }, 40 + fail(message?: string) { 41 + console.error(`✗ ${message ?? currentText}`) 42 + return this 43 + }, 44 + } 45 + } 46 + 23 47 const s = spinner() 24 48 let currentText = text 25 49 let started = false

History

1 round 0 comments
sign up or login to add to the discussion
niri.pet submitted #0
1 commit
expand
add --quiet flag and WISPCTL_NO_PROGRESS env var to suppress spinner output
merge conflicts detected
expand
  • cli/index.ts:143
  • cli/lib/progress.ts:20
expand 0 comments