[READ-ONLY] Mirror of https://github.com/bombshell-dev/clack. Effortlessly build beautiful command-line apps bomb.sh/docs/clack/basics/getting-started/
cli command-line command-line-app node prompt prompts
5

Configure Feed

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

feat: add log

Oskar Löfgren (Feb 24, 2023, 12:54 AM +0100) dfb796e2 ab1c7f66

+26
+26
packages/prompts/src/index.ts
··· 38 38 const S_CONNECT_LEFT = s('├', '+'); 39 39 const S_CORNER_BOTTOM_RIGHT = s('╯', '+'); 40 40 41 + const S_INFO = s('ℹ', 'i'); 42 + const S_SUCCESS = s('✔', '√'); 43 + const S_WARN = s('⚠', '!'); 44 + const S_ERROR = s('✘', 'x'); 45 + 41 46 const symbol = (state: State) => { 42 47 switch (state) { 43 48 case 'initial': ··· 407 412 408 413 export const outro = (message = '') => { 409 414 process.stdout.write(`${color.gray(S_BAR)}\n${color.gray(S_BAR_END)} ${message}\n\n`); 415 + }; 416 + 417 + export type LogMessageOptions = { 418 + symbol?: string; 419 + }; 420 + export const log = { 421 + message: (message = '', { symbol = color.gray(S_BAR) }: LogMessageOptions = {}) => { 422 + process.stdout.write(`${color.gray(S_BAR)}\n${symbol} ${message}\n`); 423 + }, 424 + info: (message: string) => { 425 + log.message(message, { symbol: color.blue(S_INFO) }); 426 + }, 427 + success: (message: string) => { 428 + log.message(message, { symbol: color.green(S_SUCCESS) }); 429 + }, 430 + warn: (message: string) => { 431 + log.message(message, { symbol: color.yellow(S_WARN) }); 432 + }, 433 + error: (message: string) => { 434 + log.message(message, { symbol: color.red(S_ERROR) }); 435 + }, 410 436 }; 411 437 412 438 const frames = unicode ? ['◒', '◐', '◓', '◑'] : ['•', 'o', 'O', '0'];